Documentation ¶
Index ¶
- func Application(opts ...Option) *cobra.Command
- func Devices(opts ...Option) *cobra.Command
- func ExecuteParentPersistentPostRun(cmd *cobra.Command, args []string) error
- func ExecuteParentPersistentPreRun(cmd *cobra.Command, args []string) error
- func Export(cmd *cobra.Command, args []string, f func(s source.Source, item string) error) error
- func New(opts ...Option) *cobra.Command
- func Source(sourceName, short string, opts ...SourceOptions) *cobra.Command
- type CobraRun
- type CobraRunE
- type Iterator
- type Option
- func WithAliases(a []string) Option
- func WithFlagSet(fs *pflag.FlagSet) Option
- func WithGroupID(id string) Option
- func WithPersistentPostRun(f CobraRun) Option
- func WithPersistentPostRunE(f CobraRunE) Option
- func WithPersistentPreRun(f CobraRun) Option
- func WithPersistentPreRunE(f CobraRunE) Option
- func WithPostRun(f CobraRun) Option
- func WithPostRunE(f CobraRunE) Option
- func WithPreRun(f CobraRun) Option
- func WithPreRunE(f CobraRunE) Option
- func WithRun(f CobraRun) Option
- func WithRunE(f CobraRunE) Option
- func WithShort(s string) Option
- func WithSubcommands(cmd ...*cobra.Command) Option
- func WithUse(s string) Option
- type SourceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Application ¶
Application returns a new application command.
func ExecuteParentPersistentPostRun ¶
ExecuteParentPersistentPostRun executes cmd's parent's PersistentPostRunE or PersistentPostRun.
func ExecuteParentPersistentPreRun ¶
ExecuteParentPersistentPreRun executes cmd's parent's PersistentPreRunE or PersistentPreRun.
Types ¶
type CobraRunE ¶
func ExportApplication ¶
func ExportApplication() CobraRunE
func ExportDevices ¶
func ExportDevices() CobraRunE
func SourcePersistentPreRunE ¶
func SourcePersistentPreRunE() CobraRunE
SourcePersistentPreRunE returns a new function that sets the active source.
type Iterator ¶
type Iterator interface { // Next returns the next item from the iterator. io.EOF is returned when no more items are left. Next() (item string, err error) }
Iterator returns items
func NewListIterator ¶
NewListIterator returns a new iterator from a list of items.
type Option ¶
Option allows extending the command when it is instantiated with New.
func WithAliases ¶
WithAliases returns an option that sets the command's Aliases field.
func WithFlagSet ¶
WithFlagSet returns an option that adds a flag set to the command's flags.
func WithGroupID ¶
WithGroupID returns an option that sets the command's GroupID field.
func WithPersistentPostRun ¶
WithPersistentPostRun returns an option that sets the command's PersistentPostRun field.
func WithPersistentPostRunE ¶
WithPersistentPostRunE returns an option that sets the command's PersistentPostRunE field.
func WithPersistentPreRun ¶
WithPersistentPreRun returns an option that sets the command's PersistentPreRun field.
func WithPersistentPreRunE ¶
WithPersistentPreRunE returns an option that sets the command's PersistentPreRunE field.
func WithPostRun ¶
WithPostRun returns an option that sets the command's PostRun field.
func WithPostRunE ¶
WithPostRunE returns an option that sets the command's PostRunE field.
func WithPreRun ¶
WithPreRun returns an option that sets the command's PreRun field.
func WithPreRunE ¶
WithPreRunE returns an option that sets the command's PreRunE field.
func WithSubcommands ¶
WithSubcommands returns an option that adds commands cmd to the command.
type SourceOptions ¶
type SourceOptions struct {
// contains filtered or unexported fields
}
func WithApplicationOptions ¶
func WithApplicationOptions(opts ...Option) SourceOptions
WithApplicationOptions returns SourceOptions with appOpts field set to opts.
func WithDevicesOptions ¶
func WithDevicesOptions(opts ...Option) SourceOptions
WithDevicesOptions returns SourceOptions with devOpts field set to opts.
func WithSourceOptions ¶
func WithSourceOptions(opts ...Option) SourceOptions
WithSourceOptions returns SourceOptions with opts field set to opts.
func (*SourceOptions) Extend ¶
func (s *SourceOptions) Extend(src SourceOptions)
Extend merges respectable fields from src into s.