faa06040e4 | ||
---|---|---|
.. | ||
README.md |
README.md
Command-Line Interface (CLI)
This section is a work in progress.
The consul
binary provides a CLI for interacting with the HTTP API. Some commands may
also exec other processes or generate data used by Consul (ex: tls certificates). The
agent
command is responsible for starting the Consul agent.
The cli reference in Consul user documentation has a full reference to all available commands.
Code
The CLI entrypoint is main.go and the majority of the source for the CLI is under the command directory. Each subcommand is a separate package under command. The CLI uses github.com/mitchellh/cli as a framework, and uses the flag package from the stdlib for command line flags.
Important notes
The cli.Ui wraps an io.Writer
for both stdout and stderr. At the time of writing both
Info
and Output
go to stdout. Writing Info
to stdout has been a source of a couple
bugs. To prevent these bugs in the future it is recommended that Info
should no longer
be used. Instead, send all information messages to stderr by using Warn
.