1
0
Fork 0
mirror of https://github.com/spf13/cobra synced 2025-08-13 13:17:50 +00:00

Adjust bash completion instructions for compatibility with bash 3.2

Bash 3.2 is the default shell on macOS Mojave and other OSs, but the old instructions for sourcing completion scripts into one's shell don't work with it:

```
. <(cmd completion)
```

This is because the `source` (`.`) builtin doesn't work with process substitution in 3.2. https://lists.gnu.org/archive/html/bug-bash/2006-01/msg00018.html

The `eval` approach is portable between different bash versions.
This commit is contained in:
Mislav Marohnić 2019-10-04 14:03:48 +02:00 committed by GitHub
commit 3a8f0055e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,12 +17,12 @@ var completionCmd = &cobra.Command{
Short: "Generates bash completion scripts",
Long: `To load completion run
. <(bitbucket completion)
eval "$(bitbucket completion)"
To configure your bash shell to load completions for each session add to your bashrc
# ~/.bashrc or ~/.profile
. <(bitbucket completion)
eval "$(bitbucket completion)"
`,
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenBashCompletion(os.Stdout);