feat(autocomplete): add autocompletion for fish shell
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
14187449a5
commit
521d3d1259
11
cli/cli.go
11
cli/cli.go
@ -29,7 +29,7 @@ var AutoCompleteCommand = cli.Command{
|
|||||||
Description: `
|
Description: `
|
||||||
Set up auto-completion in your shell by downloading the relevant files and
|
Set up auto-completion in your shell by downloading the relevant files and
|
||||||
laying out what additional information must be loaded. Supported shells are as
|
laying out what additional information must be loaded. Supported shells are as
|
||||||
follows: bash, fizsh & zsh.
|
follows: bash, fish, fizsh & zsh.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ Example:
|
|||||||
"bash": true,
|
"bash": true,
|
||||||
"zsh": true,
|
"zsh": true,
|
||||||
"fizsh": true,
|
"fizsh": true,
|
||||||
|
"fish": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := supportedShells[shellType]; !ok {
|
if _, ok := supportedShells[shellType]; !ok {
|
||||||
@ -93,6 +94,14 @@ sudo mkdir /etc/zsh/completion.d/
|
|||||||
sudo cp %s /etc/zsh/completion.d/abra
|
sudo cp %s /etc/zsh/completion.d/abra
|
||||||
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
||||||
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app domains listed!
|
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app domains listed!
|
||||||
|
`, autocompletionFile))
|
||||||
|
case "fish":
|
||||||
|
fmt.Println(fmt.Sprintf(`
|
||||||
|
# Run the following commands to install auto-completion
|
||||||
|
sudo mkdir -p /etc/fish/completions
|
||||||
|
sudo cp %s /etc/fish/completions/abra
|
||||||
|
echo "source /etc/fish/completions/abra" >> ~/.config/fish/config.fish
|
||||||
|
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app domains listed!
|
||||||
`, autocompletionFile))
|
`, autocompletionFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
scripts/autocomplete/fish
Normal file
7
scripts/autocomplete/fish
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function complete_abra_args
|
||||||
|
set -l cmd (commandline -poc) --generate-bash-completion
|
||||||
|
$cmd
|
||||||
|
end
|
||||||
|
complete -c abra -f -n "not __fish_seen_subcommand_from -h --help -v --version complete_abra_args" -a "(complete_abra_args)"
|
||||||
|
complete -c abra -f -s h -l help -d 'show help'
|
||||||
|
complete -c abra -f -s v -l version -d 'print the version'
|
@ -8,3 +8,5 @@ run_test '$ABRA autocomplete bash'
|
|||||||
run_test '$ABRA autocomplete fizsh'
|
run_test '$ABRA autocomplete fizsh'
|
||||||
|
|
||||||
run_test '$ABRA autocomplete zsh'
|
run_test '$ABRA autocomplete zsh'
|
||||||
|
|
||||||
|
run_test '$ABRA autocomplete fish'
|
||||||
|
Loading…
Reference in New Issue
Block a user