Documentation ¶
Index ¶
- Constants
- func NewCompletionCmd(rootCmd *cobra.Command, hidden bool) *cobra.Command
- func RunCaptureWithArgs(cmd Executable, args []string, env map[string]string) (stdout, stderr string, err error)
- func RunWithArgs(cmd Executable, args []string, env map[string]string) error
- func WriteConfigVals(dir string, vals map[string]string) error
- type Executable
- type Executor
- type ExitCoder
Constants ¶
const ( HomeFlag = "home" TraceFlag = "trace" OutputFlag = "output" EncodingFlag = "encoding" )
Variables ¶
This section is empty.
Functions ¶
func NewCompletionCmd ¶ added in v0.40.0
NewCompletionCmd returns a cobra.Command that generates bash and zsh completion scripts for the given root command. If hidden is true, the command will not show up in the root command's list of available commands.
func RunCaptureWithArgs ¶
func RunCaptureWithArgs(cmd Executable, args []string, env map[string]string) (stdout, stderr string, err error)
RunCaptureWithArgs executes the given command with the specified command line args and environmental variables set. It returns string fields representing output written to stdout and stderr, additionally any error from cmd.Execute() is also returned
func RunWithArgs ¶
func RunWithArgs(cmd Executable, args []string, env map[string]string) error
RunWithArgs executes the given command with the specified command line args and environmental variables set. It returns any error returned from cmd.Execute()
Types ¶
type Executable ¶
type Executable interface {
Execute() error
}
Executable is the minimal interface to *corba.Command, so we can wrap if desired before the test
type Executor ¶
type Executor struct { *cobra.Command Exit func(int) // this is os.Exit by default, override in tests }
Executor wraps the cobra Command with a nicer Execute method
func PrepareBaseCmd ¶
PrepareBaseCmd is meant for tendermint and other servers
func PrepareMainCmd ¶
PrepareMainCmd is meant for client side libs that want some more flags
This adds --encoding (hex, btc, base64) and --output (text, json) to the command. These only really make sense in interactive commands.