/bash_completion_lib/complete/complete
http://github.com/brinkman83/bashrc · #! · 55 lines · 47 code · 8 blank · 0 comment · 0 complexity · d35c01bd5219eabffeb6dce439f46ef7 MD5 · raw file
- comp_include _get_cword
- _complete()
- {
- local cur prev options
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -o)
- options="default dirnames filenames"
- [ -n "$bash205b" ] && options="$options nospace"
- [ -n "$bash3" ] && options="$options bashdefault plusdirs"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- return 0
- ;;
- -A)
- COMPREPLY=( $( compgen -W 'alias arrayvar binding \
- builtin command directory disabled enabled \
- export file function group helptopic hostname \
- job keyword running service setopt shopt \
- signal stopped user variable' -- $cur ) )
- return 0
- ;;
- -C)
- COMPREPLY=( $( compgen -A command -- $cur ) )
- return 0
- ;;
- -F)
- COMPREPLY=( $( compgen -A function -- $cur ) )
- return 0
- ;;
- -@(p|r))
- COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
- grep "^$cur" ) )
- return 0
- ;;
- esac
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
- [ -n "$bash205" ] && options="$options -o"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- COMPREPLY=( $( compgen -A command -- $cur ) )
- fi
- }
- _complete