From 84ee8b8affb87b721cb8b1b606300b9219e883b9 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Fri, 6 Oct 2017 15:05:45 -0500 Subject: [PATCH] Autocomplete support --- main.go | 8 +++++--- website/source/docs/commands/index.html.md | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 8678c8bdff..bb696b8178 100644 --- a/main.go +++ b/main.go @@ -42,9 +42,11 @@ func realMain() int { } cli := &cli.CLI{ - Args: args, - Commands: command.Commands, - HelpFunc: cli.FilteredHelpFunc(cmds, cli.BasicHelpFunc("consul")), + Args: args, + Commands: command.Commands, + Autocomplete: true, + Name: "consul", + HelpFunc: cli.FilteredHelpFunc(cmds, cli.BasicHelpFunc("consul")), } exitCode, err := cli.Run() diff --git a/website/source/docs/commands/index.html.md b/website/source/docs/commands/index.html.md index a77cc06c3f..7554cd930a 100644 --- a/website/source/docs/commands/index.html.md +++ b/website/source/docs/commands/index.html.md @@ -79,6 +79,23 @@ Command Options Joins a server to another server in the WAN pool. ``` +## Autocompletion + +The `consul` command features opt-in subcommand autocompletion that you can +enable for your shell with `consul -autocomplete-install`. After doing so, +you can invoke a new shell and use the feature. + +For example, assume a tab is typed at the end of each prompt line: + +``` +$ consul e +event exec + +$ consul r +raft reload rtt + +``` + ## Environment Variables In addition to CLI flags, Consul reads environment variables for behavior