Documentation
¶
Overview ¶
Package cli is the Cli component of orb.
Package cli provides cli.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFlagExists is returned when the given element exists in the flag container. ErrFlagExists = errors.New("element exists already") // Plugins contains source/cli subplugins, for example urfave, pflag, cobra. Plugins = container.NewMap[ParseFunc]() //nolint:gochecknoglobals // Flags is the global flag container where you have to register flags with. Flags = container.NewList[*Flag]() //nolint:gochecknoglobals )
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string `json:"name" yaml:"name"` Version string `json:"version" yaml:"version"` }
Config is the base config for this component.
type Flag ¶
type Flag struct { Name string EnvVars []string Usage string // The path in map(\[string\])+any ConfigPath []string Default any Value any }
Flag is a Cli Flag and maybe environment variable.
type FlagOption ¶
type FlagOption func(*Flag)
FlagOption is an option for NewFlag.
func CPSlice ¶
func CPSlice(n []string) FlagOption
CPSlice is the same as ConfigPath but it accepts a slice.
func EnvVars ¶
func EnvVars(n ...string) FlagOption
EnvVars set's environment variables for the flag.
type Source ¶
type Source struct{}
Source is the cli source.
func (*Source) PrependSections ¶
PrependSections indicates whether this needs sections to be prepended, which is true in this case.
func (*Source) Read ¶
Read creates the subplugin for the given url, creates its config after and then executes it.
Click to show internal directories.
Click to hide internal directories.