mirror of
https://github.com/spf13/cobra
synced 2025-05-06 13:27:26 +00:00
Add note about hiding a command from completion
This commit is contained in:
parent
cd30c2a7e9
commit
9e57a03052
1 changed files with 11 additions and 0 deletions
|
@ -144,6 +144,17 @@ and you'll get something like
|
||||||
-c --container= -p --pod=
|
-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
|
# 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.
|
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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue