cmd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCmd added in v0.3.0

func BuildCmd(version string) *cobra.Command

func Execute

func Execute(version string)

Execute adds all child commands to the root command and executes the cmd tree

func NewCmdRoot

func NewCmdRoot(version string) *cobra.Command

NewCmdRoot creates a new root command

func NewCmdRun

func NewCmdRun() *cobra.Command

NewCmdRun creates a new run command

Types

type DurationFlag added in v0.3.0

type DurationFlag struct {
	*Flag
}

func (*DurationFlag) Bind added in v0.3.0

func (f *DurationFlag) Bind(cmd *cobra.Command, value time.Duration, usage string)

type Flag added in v0.3.0

type Flag struct {
	Config string
	Cli    string
}

func NewFlag added in v0.3.0

func NewFlag(config, cli string) *Flag

NewFlag returns a flag builder It serves as a wrapper around cobra and viper, that allows creating and binding typed cli flags to config values

Example:

NewFlag("config", "c").String().Bind(cmd, "config.yaml", "config file")

func (*Flag) Duration added in v0.3.0

func (f *Flag) Duration() *DurationFlag

func (*Flag) Int added in v0.3.0

func (f *Flag) Int() *IntFlag

func (*Flag) String added in v0.3.0

func (f *Flag) String() *StringFlag

func (*Flag) StringP added in v0.3.0

func (f *Flag) StringP(shorthand string) *StringPFlag

type IntFlag added in v0.3.0

type IntFlag struct {
	*Flag
}

func (*IntFlag) Bind added in v0.3.0

func (f *IntFlag) Bind(cmd *cobra.Command, value int, usage string)

Bind registers the flag with the command and binds it to the config

type StringFlag added in v0.3.0

type StringFlag struct {
	*Flag
}

func (*StringFlag) Bind added in v0.3.0

func (f *StringFlag) Bind(cmd *cobra.Command, value, usage string)

Bind registers the flag with the command and binds it to the config

type StringPFlag added in v0.3.0

type StringPFlag struct {
	*Flag
	// contains filtered or unexported fields
}

func (*StringPFlag) Bind added in v0.3.0

func (f *StringPFlag) Bind(cmd *cobra.Command, value, usage string)

Bind registers the flag with the command and binds it to the config

Jump to

Keyboard shortcuts

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