Documentation ¶
Index ¶
- func ErrorAndExit(format string, args ...interface{})
- func Main(do func(interface{}) error, appEnv interface{}, decoders ...Decoder)
- func ParseCommits(args []string) ([]*pfs.Commit, error)
- func Populate(object interface{}, decoders ...Decoder) error
- func Run(run func(args []string) error) func(*cobra.Command, []string)
- func RunBoundedArgs(min int, max int, run func([]string) error) func(*cobra.Command, []string)
- func RunFixedArgs(numArgs int, run func([]string) error) func(*cobra.Command, []string)
- func RunIO(ioObj IO, args ...string) error
- func RunIODirPath(ioObj IO, dirPath string, args ...string) error
- func RunStdin(stdin io.Reader, args ...string) error
- type Decoder
- type IO
- type RepeatedStringArg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorAndExit ¶
func ErrorAndExit(format string, args ...interface{})
ErrorAndExit errors with the given format and args, and then exits.
func Main ¶
Main runs the common functionality needed in a go main function. appEnv will be populated and passed to do, defaultEnv can be nil if there is an error, os.Exit(1) will be called.
func ParseCommits ¶
ParseCommits takes a slice of arguments of the form "repo/commit-id" or "repo" (in which case we consider the commit ID to be empty), and returns a list of Commits
func Populate ¶
Populate populates an object with environment variables.
The environment has precedence over the decoders, earlier decoders have precedence over later decoders.
func RunBoundedArgs ¶
RunBoundedArgs wraps a function in a function that checks its argument count is within a range.
func RunFixedArgs ¶
RunFixedArgs wraps a function in a function that checks its exact argument count.
func RunIODirPath ¶
RunIODirPath runs the command with the given IO and arguments in the given directory specified by dirPath.
Types ¶
type RepeatedStringArg ¶
type RepeatedStringArg []string
RepeatedStringArg is an alias for []string
func (*RepeatedStringArg) Set ¶
func (r *RepeatedStringArg) Set(s string) error
Set adds a string to r
func (*RepeatedStringArg) String ¶
func (r *RepeatedStringArg) String() string
func (*RepeatedStringArg) Type ¶
func (r *RepeatedStringArg) Type() string
Type returns the string representation of the type of r