Documentation
¶
Overview ¶
Package cli defines the audd command tree.
Each command group lives in its own file and adds itself with Register from an init() function, so files never need to edit root.go:
func init() {
Register(func(root *cobra.Command, a *app.App) {
root.AddCommand(newStreamsCmd(a))
})
}
Register callbacks run when the tree is built, before flags are parsed. The *app.App they receive is filled in (config, secrets, printer, flags) by the root's PersistentPreRunE before any RunE runs, so read its fields inside RunE, not in the callback.
Index ¶
Constants ¶
const ( GroupRecognize = "recognize" GroupStreams = "streams" GroupAccount = "account" GroupLocal = "local" GroupAgents = "agents" GroupOther = "other" )
Command groups shown in `audd --help`. Set cmd.GroupID to one of these.
const AnnotationStreaming = "audd:streaming"
AnnotationStreaming marks a command whose piped output defaults to JSONL (cmd.Annotations[AnnotationStreaming] = "true"). Commands that only sometimes stream call a.Out.SetStreaming() at run time instead.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute() int
Execute runs audd with os.Args and the real terminal; it returns the exit code.
func Main ¶
Main runs audd with the given arguments and streams, none of them a TTY. Tests use it (see testutil.Exec).
Types ¶
type IO ¶
type IO struct {
In io.Reader
Out, Err io.Writer
StdinTTY, StdoutTTY, StderrTTY bool
// StderrWidth is the terminal width of Err; 0 reads it from the terminal.
StderrWidth int
// StdoutWidth is the terminal width of Out; 0 reads it from the terminal.
StdoutWidth int
}
IO is the process environment a run uses.