commander

package
v0.0.0-...-a197711 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PIPEEMTPY          = ""
	PIPEUSEDBYHOSTLIST = "_PIPE_USED_BY_HOSTLIST"
	PIPEUSEDBYCMD      = "_PIPE_USED_BY_CMD"
)

Input From Pipe/HereDoc

Variables

View Source
var AccountFlag = cli.StringFlag{
	Name:   "account",
	Usage:  "Some Executors need an Account to initiate",
	EnvVar: "ACCOUNT",
}

AccountFlag `--account`

View Source
var ConcurrencyFlag = cli.IntFlag{
	Name:   "concurrency, c",
	Value:  1,
	Usage:  "Concurrency",
	EnvVar: "CONCURRENCY",
}

ConcurrencyFlag `-c`

View Source
var HostsFlag = cli.StringFlag{
	Name:  "hosts, f",
	Usage: "Hostname List",
}

HostsFlag `-f`

View Source
var JSONFlag = cli.BoolFlag{
	Name:  "json, j",
	Usage: "Prints in JSON",
}

JSONFlag `-j`

View Source
var MethodFlag = cli.StringFlag{
	Name:   "method, m",
	Value:  "ssh",
	EnvVar: "METHOD",
	Usage:  "How to execute the commands",
}

MethodFlag `-m`

View Source
var PasswdFlag = cli.BoolFlag{
	Name:  "passwd, p",
	Usage: "Add Password Authentication Method",
}

PasswdFlag `-p`

View Source
var PasswordFlag = cli.StringFlag{
	Name:   "password",
	EnvVar: "PASSWORD",
	Usage:  "Specify password in Command Line",
}

PasswordFlag `--password`

View Source
var PreferFlag = cli.StringFlag{
	Name:   "prefer",
	EnvVar: "PREFER",
	Usage:  "Override default hostlist lookup chain",
}

PreferFlag `--prefer`

View Source
var RetryFlag = cli.IntFlag{
	Name:  "retry",
	Usage: "Retry",
	Value: 0,
}

RetryFlag `--retry`

View Source
var TimeoutFlag = cli.IntFlag{
	Name:  "timeout, t",
	Usage: "Timeout. Unit: s",
	Value: 0,
}

TimeoutFlag `-t`

View Source
var UserFlag = cli.StringFlag{
	Name:   "user, u",
	Usage:  "Username",
	EnvVar: "USER,USER",
}

UserFlag `-u`

View Source
var WindowFlag = cli.BoolFlag{
	Name:  "window, w",
	Usage: "Vim-like Command-Line User Interface",
}

WindowFlag `-w`

Functions

func GetCmd

func GetCmd(c *cli.Context) (cmd string)

GetCmd extracts cmd from command line

func GetHostList

func GetHostList(hostsArg, prefer string) (list hostlist.HostInfoList, err error)

GetHostList gets hostlist from flag/pipe

@hostsArg: argument for hostlist to generate HostInfoList
@prefer: preferred method to get hostlist(PreferFlag)

func Init

func Init()

Init collects all Commands

func PrepareExecutor

func PrepareExecutor(c *cli.Context) *executor.Executor

PrepareExecutor fills Executor

func Run

func Run() error

Run starts gsck

func SetupFormatter

func SetupFormatter(c *cli.Context, exe *executor.Executor) (err error)

SetupFormatter *MUST* be called after hostlist is ready

func SetupParameter

func SetupParameter(c *cli.Context) executor.Parameter

SetupParameter translates cli flags into Parameter

Types

This section is empty.

Jump to

Keyboard shortcuts

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