Skip to content

Commit

Permalink
Add completion to help message (#478)
Browse files Browse the repository at this point in the history
Fixes #477
  • Loading branch information
navidshaikh authored and knative-prow-robot committed Nov 12, 2019
1 parent d66887a commit c4a9197
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/cmd/kn.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Manage your Knative building blocks:

### SEE ALSO

* [kn completion](kn_completion.md) - Output shell completion code
* [kn plugin](kn_plugin.md) - Plugin command group
* [kn revision](kn_revision.md) - Revision command group
* [kn route](kn_route.md) - Route command group
Expand Down
47 changes: 47 additions & 0 deletions docs/cmd/kn_completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## kn completion

Output shell completion code

### Synopsis


This command prints shell completion code which needs to be evaluated
to provide interactive completion

Supported Shells:
- bash
- zsh

```
kn completion [SHELL] [flags]
```

### Examples

```
# Generate completion code for bash
source <(kn completion bash)
# Generate completion code for zsh
source <(kn completion zsh)
```

### Options

```
-h, --help help for completion
```

### Options inherited from parent commands

```
--config string kn config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--log-http log http traffic
```

### SEE ALSO

* [kn](kn.md) - Knative client

3 changes: 1 addition & 2 deletions pkg/kn/commands/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

const (
desc = `
This command prints shell completion code which need to be evaluated
This command prints shell completion code which needs to be evaluated
to provide interactive completion
Supported Shells:
Expand All @@ -47,7 +47,6 @@ func NewCompletionCommand(p *commands.KnParams) *cobra.Command {
Long: desc,
ValidArgs: []string{"bash", "zsh"},
Example: eg,
Hidden: true, // Don't show this in help listing
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 1 {
switch args[0] {
Expand Down

0 comments on commit c4a9197

Please sign in to comment.