Tabs to spaces

pull/1043/head
Nils Winkler 2017-09-15 08:10:15 +02:00
parent 7a3603f80d
commit 752d4afe41
1 changed files with 78 additions and 78 deletions

View File

@ -2,112 +2,112 @@
_bash-it-comp-enable-disable() _bash-it-comp-enable-disable()
{ {
local enable_disable_args="alias plugin completion" local enable_disable_args="alias plugin completion"
COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) )
} }
_bash-it-comp-list-available-not-enabled() _bash-it-comp-list-available-not-enabled()
{ {
subdirectory="$1" subdirectory="$1"
local available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`; local available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`;
do do
if [ ! -e "${BASH_IT}/$subdirectory/enabled/"$(basename $f) ] && [ ! -e "${BASH_IT}/$subdirectory/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $f) ] if [ ! -e "${BASH_IT}/$subdirectory/enabled/"$(basename $f) ] && [ ! -e "${BASH_IT}/$subdirectory/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $f) ]
then then
basename $f | cut -d'.' -f1 basename $f | cut -d'.' -f1
fi fi
done) done)
COMPREPLY=( $(compgen -W "all ${available_things}" -- ${cur}) ) COMPREPLY=( $(compgen -W "all ${available_things}" -- ${cur}) )
} }
_bash-it-comp-list-enabled() _bash-it-comp-list-enabled()
{ {
subdirectory="$1" subdirectory="$1"
local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/enabled/*.bash" | sort`; local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/enabled/*.bash" | sort`;
do do
basename $f | cut -d'.' -f1 | sed -e "s/^[0-9]*---//g" basename $f | cut -d'.' -f1 | sed -e "s/^[0-9]*---//g"
done) done)
COMPREPLY=( $(compgen -W "all ${enabled_things}" -- ${cur}) ) COMPREPLY=( $(compgen -W "all ${enabled_things}" -- ${cur}) )
} }
_bash-it-comp-list-available() _bash-it-comp-list-available()
{ {
subdirectory="$1" subdirectory="$1"
local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`; local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`;
do do
basename $f | cut -d'.' -f1 basename $f | cut -d'.' -f1
done) done)
COMPREPLY=( $(compgen -W "${enabled_things}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${enabled_things}" -- ${cur}) )
} }
_bash-it-comp() _bash-it-comp()
{ {
local cur prev opts prevprev local cur prev opts prevprev
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
chose_opt="${COMP_WORDS[1]}" chose_opt="${COMP_WORDS[1]}"
file_type="${COMP_WORDS[2]}" file_type="${COMP_WORDS[2]}"
opts="help show enable disable update search migrate" opts="help show enable disable update search migrate"
case "${chose_opt}" in case "${chose_opt}" in
show) show)
local show_args="plugins aliases completions" local show_args="plugins aliases completions"
COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) )
return 0 return 0
;; ;;
help) help)
local help_args="plugins aliases completions migrate update" local help_args="plugins aliases completions migrate update"
COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) )
return 0 return 0
;; ;;
update | search | migrate) update | search | migrate)
return 0 return 0
;; ;;
enable | disable) enable | disable)
if [ x"${chose_opt}" == x"enable" ];then if [ x"${chose_opt}" == x"enable" ];then
suffix="available-not-enabled" suffix="available-not-enabled"
else else
suffix="enabled" suffix="enabled"
fi fi
case "${file_type}" in case "${file_type}" in
alias) alias)
_bash-it-comp-list-${suffix} aliases _bash-it-comp-list-${suffix} aliases
return 0 return 0
;; ;;
plugin) plugin)
_bash-it-comp-list-${suffix} plugins _bash-it-comp-list-${suffix} plugins
return 0 return 0
;; ;;
completion) completion)
_bash-it-comp-list-${suffix} completion _bash-it-comp-list-${suffix} completion
return 0 return 0
;; ;;
*) *)
_bash-it-comp-enable-disable _bash-it-comp-enable-disable
return 0 return 0
;; ;;
esac esac
;; ;;
aliases) aliases)
prevprev="${COMP_WORDS[COMP_CWORD-2]}" prevprev="${COMP_WORDS[COMP_CWORD-2]}"
case "${prevprev}" in case "${prevprev}" in
help) help)
_bash-it-comp-list-available aliases _bash-it-comp-list-available aliases
return 0 return 0
;; ;;
esac esac
;; ;;
esac esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
} }
# Activate completion for bash-it and its common misspellings # Activate completion for bash-it and its common misspellings