Documentation
¶
Index ¶
- type BareCommand
- type Command
- type CommandDescription
- type CommandDescriptionOption
- func WithArguments(a ...*parameters.ParameterDefinition) CommandDescriptionOption
- func WithFlags(f ...*parameters.ParameterDefinition) CommandDescriptionOption
- func WithLayers(l ...layers.ParameterLayer) CommandDescriptionOption
- func WithLayout(l *layout.Layout) CommandDescriptionOption
- func WithLong(s string) CommandDescriptionOption
- func WithName(s string) CommandDescriptionOption
- func WithParents(p ...string) CommandDescriptionOption
- func WithPrependParents(p ...string) CommandDescriptionOption
- func WithPrependSource(s string) CommandDescriptionOption
- func WithReplaceArguments(args ...*parameters.ParameterDefinition) CommandDescriptionOption
- func WithReplaceFlags(flags ...*parameters.ParameterDefinition) CommandDescriptionOption
- func WithReplaceLayers(layers_ ...layers.ParameterLayer) CommandDescriptionOption
- func WithShort(s string) CommandDescriptionOption
- func WithSource(s string) CommandDescriptionOption
- func WithStripParentsPrefix(prefixes []string) CommandDescriptionOption
- type ExitWithoutGlazeError
- type GlazeCommand
- type WriterCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BareCommand ¶ added in v0.2.46
type Command ¶
type Command interface {
Description() *CommandDescription
}
type CommandDescription ¶
type CommandDescription struct {
Name string `yaml:"name"`
Short string `yaml:"short"`
Long string `yaml:"long,omitempty"`
Layout *layout.Layout `yaml:"layout,omitempty"`
Flags []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
Layers []layers.ParameterLayer `yaml:"layers,omitempty"`
Parents []string `yaml:",omitempty"`
// Source indicates where the command was loaded from, to make debugging easier.
Source string `yaml:",omitempty"`
}
CommandDescription contains the necessary information for registering a command with cobra. Because a command gets registered in a verb tree, a full list of Parents all the way to the root needs to be provided.
func NewCommandDescription ¶ added in v0.2.10
func NewCommandDescription(name string, options ...CommandDescriptionOption) *CommandDescription
func (*CommandDescription) Clone ¶ added in v0.2.25
func (c *CommandDescription) Clone(cloneFlagsAndArguments bool, options ...CommandDescriptionOption) *CommandDescription
func (*CommandDescription) GetFlagMap ¶ added in v0.2.54
func (c *CommandDescription) GetFlagMap() map[string]*parameters.ParameterDefinition
type CommandDescriptionOption ¶ added in v0.2.10
type CommandDescriptionOption func(*CommandDescription)
func WithArguments ¶ added in v0.2.10
func WithArguments(a ...*parameters.ParameterDefinition) CommandDescriptionOption
func WithFlags ¶ added in v0.2.10
func WithFlags(f ...*parameters.ParameterDefinition) CommandDescriptionOption
func WithLayers ¶ added in v0.2.10
func WithLayers(l ...layers.ParameterLayer) CommandDescriptionOption
func WithLayout ¶ added in v0.2.70
func WithLayout(l *layout.Layout) CommandDescriptionOption
func WithLong ¶ added in v0.2.10
func WithLong(s string) CommandDescriptionOption
func WithName ¶ added in v0.2.25
func WithName(s string) CommandDescriptionOption
func WithParents ¶ added in v0.2.10
func WithParents(p ...string) CommandDescriptionOption
func WithPrependParents ¶ added in v0.2.27
func WithPrependParents(p ...string) CommandDescriptionOption
func WithPrependSource ¶ added in v0.2.27
func WithPrependSource(s string) CommandDescriptionOption
func WithReplaceArguments ¶ added in v0.2.25
func WithReplaceArguments(args ...*parameters.ParameterDefinition) CommandDescriptionOption
func WithReplaceFlags ¶ added in v0.2.25
func WithReplaceFlags(flags ...*parameters.ParameterDefinition) CommandDescriptionOption
func WithReplaceLayers ¶ added in v0.2.25
func WithReplaceLayers(layers_ ...layers.ParameterLayer) CommandDescriptionOption
func WithShort ¶ added in v0.2.10
func WithShort(s string) CommandDescriptionOption
func WithSource ¶ added in v0.2.10
func WithSource(s string) CommandDescriptionOption
func WithStripParentsPrefix ¶ added in v0.2.27
func WithStripParentsPrefix(prefixes []string) CommandDescriptionOption
type ExitWithoutGlazeError ¶ added in v0.2.16
type ExitWithoutGlazeError struct{}
func (*ExitWithoutGlazeError) Error ¶ added in v0.2.16
func (e *ExitWithoutGlazeError) Error() string
type GlazeCommand ¶ added in v0.2.45
type GlazeCommand interface {
Command
// Run is called to actually execute the command.
//
// NOTE(manuel, 2023-02-27) We can probably simplify this to only take parsed layers
//
// The ps and GlazeProcessor calls could be replaced by a GlazeCommand specific layer,
// which would allow the GlazeCommand to parse into a specific struct. The GlazeProcessor
// is just something created by the passed in GlazeLayer anyway.
//
// When we are just left with building a convenience wrapper for Glaze based commands,
// instead of forcing it into the upstream interface.
//
// https://github.com/go-go-golems/glazed/issues/217
// https://github.com/go-go-golems/glazed/issues/216
// See https://github.com/go-go-golems/glazed/issues/173
Run(
ctx context.Context,
parsedLayers map[string]*layers.ParsedParameterLayer,
ps map[string]interface{},
gp processor.TableProcessor,
) error
}
Click to show internal directories.
Click to hide internal directories.