Documentation ¶
Overview ¶
Package cmd defines the cobra command structs and an execution method for adding an improved CLI to KrakenD based api gateways
Index ¶
- Variables
- func Execute(configParser config.Parser, f Executor)
- func ExecuteRoot(configParser config.Parser, f Executor, root Root)
- func GetConfigFlag() string
- func GetConfigParser() config.Parser
- func GetDebugFlag() bool
- type Command
- type Executor
- type FlagBuilder
- func BoolFlagBuilder(dst *bool, long, short string, defaultValue bool, help string) FlagBuilder
- func CountFlagBuilder(dst *int, long, short, help string) FlagBuilder
- func DurationFlagBuilder(dst *time.Duration, long, short string, defaultValue time.Duration, ...) FlagBuilder
- func Float64FlagBuilder(dst *float64, long, short string, defaultValue float64, help string) FlagBuilder
- func IntFlagBuilder(dst *int, long, short string, defaultValue int, help string) FlagBuilder
- func StringFlagBuilder(dst *string, long, short, defaultValue, help string) FlagBuilder
- type LastSourcer
- type Root
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultRoot Root RootCommand Command RunCommand Command CheckCommand Command PluginCommand Command VersionCommand Command AuditCommand Command )
View Source
var IsTTY = isatty.IsTerminal(os.Stderr.Fd())
View Source
var RunRouterFunc = func(cfg config.ServiceConfig) (err error) { defer func() { if r := recover(); r != nil { err = errors.New(r.(string)) } }() gin.SetMode(gin.ReleaseMode) cfg.Debug = cfg.Debug || debug > 0 if port != 0 { cfg.Port = port } ctx, cancel := context.WithTimeout(context.Background(), time.Second) krakendgin.DefaultFactory(proxy.DefaultFactory(logging.NoOp), logging.NoOp).NewWithContext(ctx).Run(cfg) cancel() return nil }
View Source
var SchemaURL = "https://www.krakend.io/schema/v%s/krakend.json"
Functions ¶
func Execute ¶
Execute sets up the cmd package with the received configuration parser and executor and delegates the CLI execution to the cobra lib
func GetConfigFlag ¶
func GetConfigFlag() string
func GetConfigParser ¶
func GetDebugFlag ¶
func GetDebugFlag() bool
Types ¶
type Command ¶
type Command struct { Cmd *cobra.Command Flags []FlagBuilder // contains filtered or unexported fields }
func NewCommand ¶
func NewCommand(command *cobra.Command, flags ...FlagBuilder) Command
func (*Command) AddFlag ¶
func (c *Command) AddFlag(f FlagBuilder)
func (*Command) AddSubCommand ¶
func (*Command) BuildFlags ¶
func (c *Command) BuildFlags()
type Executor ¶
type Executor func(config.ServiceConfig)
Executor defines the function that requires a service description
type FlagBuilder ¶
func BoolFlagBuilder ¶
func BoolFlagBuilder(dst *bool, long, short string, defaultValue bool, help string) FlagBuilder
func CountFlagBuilder ¶
func CountFlagBuilder(dst *int, long, short, help string) FlagBuilder
func DurationFlagBuilder ¶
func Float64FlagBuilder ¶
func Float64FlagBuilder(dst *float64, long, short string, defaultValue float64, help string) FlagBuilder
func IntFlagBuilder ¶
func IntFlagBuilder(dst *int, long, short string, defaultValue int, help string) FlagBuilder
func StringFlagBuilder ¶
func StringFlagBuilder(dst *string, long, short, defaultValue, help string) FlagBuilder
type LastSourcer ¶ added in v2.3.0
Click to show internal directories.
Click to hide internal directories.