| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #!/usr/bin/env bash
- _drk()
- {
- local cur prev opts
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
- # don't complet =
- _init_completion -n = || return
- opts="-h"
- opts+=" -c "
- opts+=" -v "
- opts+=" -V"
- opts+=" deposit"
- opts+=" features"
- opts+=" hello"
- opts+=" help"
- opts+=" id"
- opts+=" transfer"
- opts+=" wallet"
- opts+=" withdraw"
- # Prevent word reuse
- lim=$((COMP_CWORD - 1))
- for i in $( seq 0 $lim )
- do
- if [[ $opts == *"${COMP_WORDS[i]}"* ]]; then
- opts=${opts//${COMP_WORDS[i]}/}
- opts=${opts//--${COMP_WORDS[i]}/}
- fi
- done
- # case $prev in
- # -v)
- # opts=$(./drk --verbose | sed -e '$d')
- # COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
- # return 0
- # ;;
- # esac
- #
- # case $prev in
- # --V)
- # opts=$(./drk --version | sed -e '$d')
- # COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
- # return 0
- # ;;
- # esac
- COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") $(compgen -W "${opts}" -- ${cur}) )
- [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
- }
- complete -F _drk drk
- _darkfid()
- {
- local cur prev opts
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
- _init_completion -n = || return
- opts="-h"
- opts+=" -c "
- opts+=" -v "
- opts+=" -V"
- lim=$((COMP_CWORD - 1))
- for i in $( seq 0 $lim )
- do
- if [[ $opts == *"${COMP_WORDS[i]}"* ]]; then
- opts=${opts//${COMP_WORDS[i]}/}
- opts=${opts//--${COMP_WORDS[i]}/}
- fi
- done
- COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") $(compgen -W "${opts}" -- ${cur}) )
- [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
- }
- complete -F _darkfid darkfid
|