Documentation ¶
Index ¶
- Variables
- func AddCommandBuilder(f CommandBuilder)
- func DelegateCmd(cmd *cobra.Command, commands ...*exec.Cmd) (err error)
- func Execute(args []string) int
- func ExecuteRoot(rootCmd *cobra.Command, args []string) int
- func NewRootCommand(cfg *config.ProjectConfig) *cobra.Command
- func QuietErrorOrNil(err error) error
- type CommandBuilder
- type QuietError
Constants ¶
This section is empty.
Variables ¶
var Version = "[development]"
Version is the program version, filled in from git during build process.
Functions ¶
func AddCommandBuilder ¶
func AddCommandBuilder(f CommandBuilder)
AddCommandBuilder takes the provided function and adds it to the list of commands that will be added to the root command when it is built.
func DelegateCmd ¶
DelegateCmd runs with a delegator made from a `cobra.Cmd`.
func ExecuteRoot ¶
ExecuteRoot executes the passed root command with the provided args. This simplifies testing.
func NewRootCommand ¶
func NewRootCommand(cfg *config.ProjectConfig) *cobra.Command
NewRootCommand takes a config value and returns a new root command.
func QuietErrorOrNil ¶
QuietErrorOrNil returns nil if passed nil otherwise wraps the provided error in a QuietError.
Types ¶
type CommandBuilder ¶
type CommandBuilder func(*config.ProjectConfig) *cobra.Command
CommandBuilder is a function that takes the project config as an argument and returns a cobra command.
type QuietError ¶
type QuietError struct {
// contains filtered or unexported fields
}
QuietError will print its message without usage information.
func NewQuietError ¶
func NewQuietError(err error) *QuietError
NewQuietError takes a return and returns a new QuietError.
func (*QuietError) Error ¶
func (e *QuietError) Error() string
Error returns the error message string.