Documentation
¶
Overview ¶
Package cli provides utilities for happy command line interfaces.
Index ¶
- Variables
- func AskForConfirmation(q string) bool
- func AskForInput(q string) string
- func AskForSecret(q string) string
- func Exec(sess *session.Context, cmd *exec.Cmd) (string, error)
- func ExecRaw(sess *session.Context, cmd *exec.Cmd) ([]byte, error)
- func Run(sess *session.Context, cmd *exec.Cmd) error
- type Flag
- func NewBoolFlag(name string, value bool, usage string, aliases ...string) Flag
- func NewDurationFlag(name string, value time.Duration, usage string, aliases ...string) Flag
- func NewFloat64Flag(name string, value float64, usage string, aliases ...string) Flag
- func NewIntFlag(name string, value int, usage string, aliases ...string) Flag
- func NewOptionFlag(name string, value []string, opts []string, usage string, aliases ...string) Flag
- func NewStringFlag(name string, value string, usage string, aliases ...string) Flag
- func NewUintFlag(name string, value uint, usage string, aliases ...string) Flag
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCommandInvalid = errors.New("invalid command definition") ErrCommandArgs = errors.New("command arguments error") ErrCommandFlags = errors.New("command flags error") ErrPanic = errors.New("there was panic, check logs for more info") )
View Source
var ( FlagVersion = varflag.BoolFunc("version", false, "com.github.happy-sdk.happy.sdk.cli.flags.version") FlagHelp = varflag.BoolFunc("help", false, "com.github.happy-sdk.happy.sdk.cli.flags.help", "h") FlagX = varflag.BoolFunc("show-exec", false, "com.github.happy-sdk.happy.sdk.cli.flags.show_exec", "x") FlagSystemDebug = varflag.BoolFunc("system-debug", false, "com.github.happy-sdk.happy.sdk.cli.flags.system_debug") FlagDebug = varflag.BoolFunc("debug", false, "com.github.happy-sdk.happy.sdk.cli.flags.debug") FlagVerbose = varflag.BoolFunc("verbose", false, "com.github.happy-sdk.happy.sdk.cli.flags.verbose", "v") )
Common CLI flags which are automatically attached to the CLI ubnless disabled ins settings. You still can manually add them to your CLI if you want to.
View Source
var (
FlagXProd = varflag.BoolFunc("x-prod", false, "com.github.happy-sdk.happy.sdk.cli.flags.x_prod")
)
FlagProd is a flag that forces the application into production mode.
Functions ¶
func AskForConfirmation ¶
AskForConfirmation gets (y/Y)es or (n/N)o from cli input.
func AskForInput ¶
func AskForSecret ¶
Types ¶
type Flag ¶ added in v0.100.0
type Flag = varflag.FlagCreateFunc
func NewBoolFlag ¶ added in v0.100.0
func NewDurationFlag ¶ added in v0.100.0
func NewFloat64Flag ¶ added in v0.100.0
func NewIntFlag ¶ added in v0.100.0
func NewOptionFlag ¶ added in v0.100.0
func NewStringFlag ¶ added in v0.100.0
Click to show internal directories.
Click to hide internal directories.