Documentation
¶
Overview ¶
Package cmdutil provides support for implementing command line utilities.
Index ¶
- func CopyAll(fromDir, toDir string, ovewrite bool) error
- func CopyFile(from, to string, perms os.FileMode, overwrite bool) (returnErr error)
- func Exit(format string, args ...interface{})
- func HandleSignals(fn func(), signals ...os.Signal)
- func IsDir(path string) bool
- func ListDir(dir string) ([]string, error)
- func ListRegular(dir string) ([]string, error)
- func VCSInfo() (revision string, lastCommit time.Time, dirty, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyAll ¶
CopyAll will create an exact copy, including permissions, of a local filesystem hierarchy. The arguments must both refer to directories. A trailing slash (/) for the fromDir copies the contents of fromDir rather than fromDir itself. Thus:
CopyAll("a/b", "c") is the same as CopyAll("a/b/", "c/b") and both create an exact copy of the tree a/b rooted at c/b.
If overwrite is set any existing files will be overwritten. Existing directories will always have their contents updated. It is suitable for very large directory trees since it uses filepath.Walk.
func CopyFile ¶
CopyFile will copy a local file with the option to overwrite an existing file and to set the permissions on the new file. It uses chmod to explicitly set permissions. It is not suitable for very large fles.
func Exit ¶
func Exit(format string, args ...interface{})
Exit formats and prints the supplied parameters to os.Stderr and then calls os.Exit(1).
func HandleSignals ¶
HandleSignals will asynchronously invoke the supplied function when the specified signals are received.
func ListRegular ¶
ListRegular returns the lexicographically ordered regular files that lie beneath dir.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package boolexpr provides a boolean expression evaluator and parser.
|
Package boolexpr provides a boolean expression evaluator and parser. |
Package cmdexec provides a means of executing multiple subcommands with the ability to expand the command line arguments using Go's text/template package and environment variables.
|
Package cmdexec provides a means of executing multiple subcommands with the ability to expand the command line arguments using Go's text/template package and environment variables. |
Package expect provides support for making expectations on the contents of input streams.
|
Package expect provides support for making expectations on the contents of input streams. |
Package flags provides support for working with flag variables, and for managing flag variables by embedding them in structs.
|
Package flags provides support for working with flag variables, and for managing flag variables by embedding them in structs. |
Package profiling provides support for enabling profiling of command line tools via flags.
|
Package profiling provides support for enabling profiling of command line tools via flags. |
Package signals provides support for working with operating system signals and contexts.
|
Package signals provides support for working with operating system signals and contexts. |
Package structdoc provides a means of exposing struct tags for use when generating documentation for those structs.
|
Package structdoc provides a means of exposing struct tags for use when generating documentation for those structs. |
Package subcmd provides a multi-level command facility of the following form:
|
Package subcmd provides a multi-level command facility of the following form: |