libs

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdMod = &cobra.Command{
	Use:   "mod",
	Short: "module",
	Long:  `module.`,
	Run: func(cmd *cobra.Command, args []string) {
		logger := configs.NewLogger(true, true, true, true, false, "console")
		if len(args) < 2 {
			logger.Info("Args must >= 1!")
			fmt.Println("###################Error Exist##################")
			os.Exit(1)
		} else {

			modName := args[0]
			modActionName := args[1]

			bagSizes := []int{5}

			cmFilter := closestmatch.New(args, bagSizes)
			modFrom := cmFilter.Closest("from=")

			var modExecContent map[string]string // 最终解析后传递给
			switch modFrom {
			case "from=str", "from=string":

				modExecContent = cmdStr2Content(args[2:])
			default:

				modExecContent = file2Content(modName, modActionName, strings.TrimLeft(modFrom, "from="), logger)
			}

			execAction(modName, modActionName, modExecContent)
		}
	},
}

Functions

This section is empty.

Types

type T

type T struct{}

func (T) NtpClient

func (t T) NtpClient(m map[string]string)

func (T) NtpNetclient

func (t T) NtpNetclient(m map[string]string)

func (T) NtpServer

func (t T) NtpServer(m map[string]string)

func (T) ShellExecute

func (t T) ShellExecute(m map[string]string)

Example: $ ./toolBox mod shell execute from=str 172.16.4.111:22:yanfa:redhat@2020 "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi" or $ ./toolBox mod shell execute from=str 172.16.4.111:22:yanfa "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi"

说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password

func (T) ShellScp

func (t T) ShellScp(m map[string]string)

Example: $ ./toolBox mod scp 172.16.4.110:22:yanfa:redhat@2020 /tmp/xxx /home/yanfa/xxx or $ ./toolBox mod scp 172.16.4.110:22:yanfa /tmp/xxx /home/yanfa/xxx

说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password

func (T) ShellStream

func (t T) ShellStream(m map[string]string)

Example: $ ./toolBox mod shell stream from=str 172.16.4.111:22:yanfa:redhat@2020 "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi" or $ ./toolBox mod shell stream from=str 172.16.4.111:22:yanfa "if [ ! -f "/data/tmp/rbac.yaml" ]; then echo xxxx; fi"

说明: - 不输入密码的时候 -> ip:port:user;输入密码的时候 -> ip:port:user:password

func (T) TelnetTest

func (t T) TelnetTest(m map[string]string)

Example: $ ./op-tools mod telnet test from=str 172.16.4.128:22 172.16.4.129:22

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL