cmd

package
v0.0.0-...-bf280d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func DelegateCmd(cmd *cobra.Command, commands ...*exec.Cmd) (err error)

DelegateCmd runs with a delegator made from a `cobra.Cmd`.

func Execute

func Execute(args []string) int

Execute loads the config and runs the root command with the provided arguments.

func ExecuteRoot

func ExecuteRoot(rootCmd *cobra.Command, args []string) int

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

func QuietErrorOrNil(err error) error

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.

func (*QuietError) Unwrap

func (e *QuietError) Unwrap() error

Unwrap returns the wrapped error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL