Documentation
¶
Overview ¶
Package cli provides CLI scaffolding utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStandardFlags ¶
func AddStandardFlags(cmd *cobra.Command, flags *StandardFlags)
AddStandardFlags adds standard flags to a cobra command.
Types ¶
type CommandBuilder ¶
type CommandBuilder struct {
// contains filtered or unexported fields
}
CommandBuilder helps build cobra commands with standard patterns.
func NewCommandBuilder ¶
func NewCommandBuilder(name, short string) *CommandBuilder
NewCommandBuilder creates a new command builder.
func (*CommandBuilder) Build ¶
func (b *CommandBuilder) Build() *cobra.Command
Build creates the cobra command.
func (*CommandBuilder) GetFlags ¶
func (b *CommandBuilder) GetFlags() *StandardFlags
GetFlags returns the standard flags.
func (*CommandBuilder) WithLong ¶
func (b *CommandBuilder) WithLong(long string) *CommandBuilder
WithLong sets the long description.
func (*CommandBuilder) WithRun ¶
func (b *CommandBuilder) WithRun(run RunFunc) *CommandBuilder
WithRun sets the run function.
type InputSource ¶
type InputSource int
InputSource represents where input comes from.
const ( // InputSourceArgs indicates input from command-line arguments. InputSourceArgs InputSource = iota // InputSourceStdin indicates input from stdin. InputSourceStdin // InputSourceFile indicates input from a file. InputSourceFile )
func ResolveInput ¶
func ResolveInput(args []string, stdinFile string) (string, InputSource, error)
ResolveInput resolves input from args, stdin, or file. Priority: args > stdin > file
Click to show internal directories.
Click to hide internal directories.