Move autocomplete files to contrib/
Since recent versions of `vndr` are going to remove the autocomplete scripts from the urfave vendored content, we will just move them into `contrib/` and reference them in the documentation from that location. Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
22
contrib/autocomplete/ctr
Executable file
22
contrib/autocomplete/ctr
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
## This file is a direct copy of https://github.com/urfave/cli/blob/a221e662f14fd7404302444a5c4293409a401210/autocomplete/bash_autocomplete
|
||||
|
||||
: ${PROG:=$(basename ${BASH_SOURCE})}
|
||||
|
||||
_cli_bash_autocomplete() {
|
||||
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 $PROG
|
||||
unset PROG
|
||||
15
contrib/autocomplete/zsh_autocomplete
Normal file
15
contrib/autocomplete/zsh_autocomplete
Normal file
@@ -0,0 +1,15 @@
|
||||
#compdef ctr
|
||||
# This file is a direct copy of https://github.com/urfave/cli/blob/a221e662f14fd7404302444a5c4293409a401210/autocomplete/zsh_autocomplete
|
||||
# With $PROG changed to ctr
|
||||
|
||||
_cli_zsh_autocomplete() {
|
||||
|
||||
local -a opts
|
||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
||||
|
||||
_describe 'values' opts
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
compdef _cli_zsh_autocomplete ctr
|
||||
Reference in New Issue
Block a user