From 9e57a0305202d3d9d1d7aaa98f9f00a4f323c7f2 Mon Sep 17 00:00:00 2001 From: Eddie Zaneski Date: Wed, 11 Apr 2018 17:36:54 -0400 Subject: [PATCH] Add note about hiding a command from completion --- bash_completions.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bash_completions.md b/bash_completions.md index 8d01f456..23464e13 100644 --- a/bash_completions.md +++ b/bash_completions.md @@ -144,6 +144,17 @@ and you'll get something like -c --container= -p --pod= ``` +## Hide commands from completion + +If you don't want a command to show up in completion you can mark it as `Hidden`. + +```go +cmd := &cobra.Command{ + ... + Hidden: true, +} +``` + # Specify valid filename extensions for flags that take a filename In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions.