tendermint: github.com/tendermint/tendermint/libs/cli Index | Files | Directories

package cli

import "github.com/tendermint/tendermint/libs/cli"


Package Files

helper.go setup.go


const (
    HomeFlag     = "home"
    TraceFlag    = "trace"
    OutputFlag   = "output"
    EncodingFlag = "encoding"

func NewCompletionCmd Uses

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 RunCaptureWithArgs Uses

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 Uses

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

func WriteConfigVals Uses

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.

type Executable Uses

type Executable interface {
    Execute() error

Executable is the minimal interface to *corba.Command, so we can wrap if desired before the test

type Executor Uses

type Executor struct {
    Exit func(int) // this is os.Exit by default, override in tests

Executor wraps the cobra Command with a nicer Execute method

func PrepareBaseCmd Uses

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

PrepareBaseCmd is meant for tendermint and other servers

func PrepareMainCmd Uses

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

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.

func (Executor) Execute Uses

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 Uses

type ExitCoder interface {
    ExitCode() int



Package cli imports 10 packages (graph) and is imported by 72 packages. Updated 2020-05-12. Refresh now. Tools for package owners.