cli

package
v0.0.0-sei-fork Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HomeFlag   = "home"
	TraceFlag  = "trace"
	OutputFlag = "output" // used in the cli
)

Variables

This section is empty.

Functions

func BindFlagsLoadViper

func BindFlagsLoadViper(cmd *cobra.Command, args []string) error

Bind all flags and read the config into viper

func InitEnv

func InitEnv(prefix string)

InitEnv sets to use ENV variables if set.

func NewCompletionCmd

func NewCompletionCmd(rootCmd *cobra.Command, hidden bool) *cobra.Command

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 PrepareBaseCmd

func PrepareBaseCmd(cmd *cobra.Command, envPrefix, defaultHome string) *cobra.Command

PrepareBaseCmd is meant for tendermint and other servers

func RunWithArgs

func RunWithArgs(ctx context.Context, cmd *cobra.Command, 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()

This is only used in testing.

func RunWithTrace

func RunWithTrace(ctx context.Context, cmd *cobra.Command) error

func WriteConfigVals

func WriteConfigVals(dir string, vals map[string]string) error

WriteConfigVals writes a toml file with the given values. It returns an error if writing was impossible.

Types

type Executable

type Executable interface {
	Execute() error
}

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 (Executor) Execute

func (e Executor) Execute() error

execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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