-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6316 from Aloxaf/fix_completion
Fix shell completions
- Loading branch information
Showing
7 changed files
with
43 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
_cli_bash_autocomplete() { | ||
local cur opts base; | ||
COMPREPLY=(); | ||
cur="${COMP_WORDS[COMP_CWORD]}"; | ||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-completion ); | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ); | ||
return 0; | ||
}; | ||
complete -F _cli_bash_autocomplete lotus | ||
if [[ "${COMP_WORDS[0]}" != "source" ]]; then | ||
local cur opts base | ||
COMPREPLY=() | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
if [[ "$cur" == "-"* ]]; then | ||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion ) | ||
else | ||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) | ||
fi | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||
return 0 | ||
fi | ||
} | ||
|
||
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete lotus lotus-miner lotus-worker |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
#!/usr/bin/env zsh | ||
autoload -U compinit && compinit; | ||
autoload -U bashcompinit && bashcompinit; | ||
_cli_bash_autocomplete() { | ||
local cur opts base; | ||
COMPREPLY=(); | ||
cur="${COMP_WORDS[COMP_CWORD]}"; | ||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-completion ); | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ); | ||
return 0; | ||
}; | ||
complete -F _cli_bash_autocomplete lotus | ||
#compdef lotus lotus-miner lotus-worker | ||
|
||
_cli_zsh_autocomplete() { | ||
|
||
local -a opts | ||
local cur | ||
cur=${words[-1]} | ||
if [[ "$cur" == "-"* ]]; then | ||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}") | ||
else | ||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}") | ||
fi | ||
|
||
if [[ "${opts[1]}" != "" ]]; then | ||
_describe 'values' opts | ||
else | ||
_files | ||
fi | ||
|
||
return | ||
} | ||
|
||
compdef _cli_zsh_autocomplete lotus lotus-miner lotus-worker |
This file was deleted.
Oops, something went wrong.