forked from toolshed/abra
fix: fix autocompletion (bash -> shell)
This commit is contained in:
parent
2c9e13d3d4
commit
ef547aed25
@ -207,8 +207,9 @@ var appCmdListCommand = cli.Command{
|
|||||||
internal.OfflineFlag,
|
internal.OfflineFlag,
|
||||||
internal.ChaosFlag,
|
internal.ChaosFlag,
|
||||||
},
|
},
|
||||||
BashComplete: autocomplete.AppNameComplete,
|
EnableShellCompletion: true,
|
||||||
Before: internal.SubCommandBefore,
|
ShellComplete: autocomplete.AppNameComplete,
|
||||||
|
Before: internal.SubCommandBefore,
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||||
app := internal.ValidateApp(cmd)
|
app := internal.ValidateApp(cmd)
|
||||||
r := recipe.Get(app.Recipe.Name)
|
r := recipe.Get(app.Recipe.Name)
|
||||||
|
@ -8,9 +8,9 @@ _cli_bash_autocomplete() {
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
if [[ "$cur" == "-"* ]]; then
|
if [[ "$cur" == "-"* ]]; then
|
||||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
|
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-shell-completion )
|
||||||
else
|
else
|
||||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
|
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-shell-completion )
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||||
return 0
|
return 0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function complete_abra_args
|
function complete_abra_args
|
||||||
set -l cmd (commandline -poc) --generate-bash-completion
|
set -l cmd (commandline -poc) --generate-shell-completion
|
||||||
$cmd
|
$cmd
|
||||||
end
|
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 -n "not __fish_seen_subcommand_from -h --help -v --version complete_abra_args" -a "(complete_abra_args)"
|
||||||
|
@ -2,7 +2,7 @@ $fn = $($MyInvocation.MyCommand.Name)
|
|||||||
$name = $fn -replace "(.*)\.ps1$", '$1'
|
$name = $fn -replace "(.*)\.ps1$", '$1'
|
||||||
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
|
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
|
||||||
param($commandName, $wordToComplete, $cursorPosition)
|
param($commandName, $wordToComplete, $cursorPosition)
|
||||||
$other = "$wordToComplete --generate-bash-completion"
|
$other = "$wordToComplete --generate-shell-completion"
|
||||||
Invoke-Expression $other | ForEach-Object {
|
Invoke-Expression $other | ForEach-Object {
|
||||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ _cli_zsh_autocomplete() {
|
|||||||
local cur
|
local cur
|
||||||
cur=${words[-1]}
|
cur=${words[-1]}
|
||||||
if [[ "$cur" == "-"* ]]; then
|
if [[ "$cur" == "-"* ]]; then
|
||||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
|
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-shell-completion)}")
|
||||||
else
|
else
|
||||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-shell-completion)}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${opts[1]}" != "" ]]; then
|
if [[ "${opts[1]}" != "" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user