From b0fa0e5b8627b9dcb1fa8009146c0225b45d4a28 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Thu, 11 Jun 2020 18:50:38 +1000 Subject: [PATCH] added shell completion instructions --- cmd/shell_completion.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/cmd/shell_completion.go b/cmd/shell_completion.go index da5e7321..b0169894 100644 --- a/cmd/shell_completion.go +++ b/cmd/shell_completion.go @@ -13,14 +13,29 @@ func createBashCompletionCmd(rootCmd *cobra.Command) *cobra.Command { var completionCmd = &cobra.Command{ Use: "shell-completion", Short: "Generates shell completion scripts", - Long: `Example usage (for bash): to load completion run - + Long: `To load completion for: +bash: + Run . <(yq bash-completion) - To configure your bash shell to load completions for each session add to your bashrc + To configure your bash shell to load completions for each session add to + your bashrc # ~/.bashrc or ~/.profile . <(yq bash-completion) + +zsh: + The generated completion script should be put somewhere in your $fpath named _yq + +powershell: + Users need PowerShell version 5.0 or above, which comes with Windows 10 and + can be downloaded separately for Windows 7 or 8.1. They can then write the + completions to a file and source this file from their PowerShell profile, + which is referenced by the $Profile environment variable. + +fish: + Save the output to a fish file and add it to your completions directory. + `, RunE: func(cmd *cobra.Command, args []string) error { switch shellVariant {