Skip to content

Commit

Permalink
fix: change cli usage manual for completion (linkerd#3999)
Browse files Browse the repository at this point in the history
Signed-off-by: jpiraguha <jiraguha@gmail.com>
  • Loading branch information
jiraguha committed Dec 2, 2020
1 parent fafeee3 commit dfa4cb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions cli/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,31 @@ import (
// newCmdCompletion creates a new cobra command `completion` which contains commands for
// enabling linkerd auto completion
func newCmdCompletion() *cobra.Command {
example := ` # bash <= 3.2
example := ` # bash <= 3.2:
source /dev/stdin <<< "$(linkerd completion bash)"
# bash >= 4.0
# bash >= 4.0:
source <(linkerd completion bash)
# bash <= 3.2 on osx
# bash <= 3.2 on osx:
brew install bash-completion # ensure you have bash-completion 1.3+
linkerd completion bash > $(brew --prefix)/etc/bash_completion.d/linkerd
# bash >= 4.0 on osx
# bash >= 4.0 on osx:
brew install bash-completion@2
linkerd completion bash > $(brew --prefix)/etc/bash_completion.d/linkerd
# zsh
source <(linkerd completion zsh)
# zsh:
# If shell completion is not already enabled in your environment you will need
# to enable it. You can execute the following once:
# zsh on osx / oh-my-zsh
echo "autoload -U compinit; compinit" >> ~/.zshrc
# To load completions for each session, execute once:
linkerd completion zsh > "${fpath[1]}/_linkerd"
# You will need to start a new shell for this setup to take effect.
# fish:
linkerd completion fish | source
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var RootCmd = &cobra.Command{

func init() {
defaultNamespace = getDefaultNamespace()
RootCmd.PersistentFlags().StringVarP(&controlPlaneNamespace, "linkerd-namespace", "L", defaultLinkerdNamespace, "Namespace in which Linkerd is installed [$LINKERD_NAMESPACE]")
RootCmd.PersistentFlags().StringVarP(&controlPlaneNamespace, "linkerd-namespace", "L", defaultLinkerdNamespace, "Namespace in which Linkerd is installed ($LINKERD_NAMESPACE)")
RootCmd.PersistentFlags().StringVarP(&cniNamespace, "cni-namespace", "", defaultCNINamespace, "Namespace in which the Linkerd CNI plugin is installed")
RootCmd.PersistentFlags().StringVar(&kubeconfigPath, "kubeconfig", "", "Path to the kubeconfig file to use for CLI requests")
RootCmd.PersistentFlags().StringVar(&kubeContext, "context", "", "Name of the kubeconfig context to use")
Expand Down

0 comments on commit dfa4cb6

Please sign in to comment.