Documentation ¶
Index ¶
- type CommandAlias
- func (a *CommandAlias) Description() *cmds.CommandDescription
- func (a *CommandAlias) IsValid() bool
- func (a *CommandAlias) Run(ctx context.Context, parsedLayers map[string]*layers.ParsedParameterLayer, ...) error
- func (a *CommandAlias) String() string
- func (a *CommandAlias) ToYAML(w io.Writer) error
- type Option
- func WithAliasFor(aliasFor string) Option
- func WithArguments(arguments []string) Option
- func WithFlags(flags map[string]string) Option
- func WithName(name string) Option
- func WithParents(parents ...string) Option
- func WithPrependSource(source string) Option
- func WithSource(source string) Option
- func WithStripParentsPrefix(prefixes []string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandAlias ¶
type CommandAlias struct { Name string `yaml:"name"` AliasFor string `yaml:"aliasFor"` Flags map[string]string `yaml:"flags,omitempty"` Arguments []string `yaml:"arguments,omitempty"` Layout []*layout.Section `yaml:"layout,omitempty"` AliasedCommand cmds.Command `yaml:",omitempty"` Parents []string `yaml:",omitempty"` Source string `yaml:",omitempty"` }
CommandAlias defines a struct that should be able to define generic aliases for any kind of command line applications, by providing overrides for certain flags (prepopulating them with certain flags and arguments, basically)
func NewCommandAlias ¶
func NewCommandAlias(options ...Option) *CommandAlias
func NewCommandAliasFromYAML ¶
func NewCommandAliasFromYAML(s io.Reader, options ...Option) (*CommandAlias, error)
func (*CommandAlias) Description ¶
func (a *CommandAlias) Description() *cmds.CommandDescription
Description returns the CommandDescription of an alias. It computes it at runtime by loading the aliased command's Description() and making copies of its flags and arguments. This is necessary because they get mutated at runtime with various defaults, depending on where they come from.
func (*CommandAlias) IsValid ¶
func (a *CommandAlias) IsValid() bool
func (*CommandAlias) Run ¶
func (a *CommandAlias) Run( ctx context.Context, parsedLayers map[string]*layers.ParsedParameterLayer, ps map[string]interface{}, gp middlewares.Processor, ) error
func (*CommandAlias) String ¶
func (a *CommandAlias) String() string
type Option ¶
type Option func(*CommandAlias)
func WithAliasFor ¶
func WithArguments ¶
func WithParents ¶
func WithPrependSource ¶
func WithSource ¶
func WithStripParentsPrefix ¶
Click to show internal directories.
Click to hide internal directories.