Documentation
¶
Overview ¶
Package cli is the flagnetic command line. Its entry takes everything a process gets from outside (arguments, environment, output streams and signals) as parameters, so tests run every command in-process.
Exit codes: 0 success, 1 a runtime failure, 2 a usage or configuration error, so tooling can tell a bad deploy from a crash.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main(args []string, lookupEnv func(string) (string, bool), stdout, stderr io.Writer, signals <-chan os.Signal, opts ...Option) int
Main runs the command named by args[0] and returns the process's exit code. lookupEnv reads the environment, as os.LookupEnv does; a value on signals asks the command to stop.
Types ¶
type Option ¶
type Option func(*options)
Option changes what a command reads from the binary or the database, or what it serves.
func WithEnvironment ¶ added in v0.7.0
WithEnvironment lets the commands that read the configuration warn about the FLAGNETIC_ variables in environ that are no setting, such as a mistyped name. environ lists the environment as os.Environ does; without the option nothing is checked, since the environment a command reads is whatever its lookup function answers.