1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- # bash programmable completion for starwelsd(1) and starwels-qt(1)
- # Copyright (c) 2012-2016 The Starwels developers
- # Distributed under the MIT software license, see the accompanying
- # file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
- _starwelsd() {
- local cur prev words=() cword
- local starwelsd
-
- # save and use original argument to invoke starwelsd for -help
- # it might not be in $PATH
- starwelsd="$1"
-
- COMPREPLY=()
- _get_comp_words_by_ref -n = cur prev words cword
-
- case "$cur" in
- -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*)
- cur="${cur#*=}"
- _filedir
- return 0
- ;;
- -datadir=*)
- cur="${cur#*=}"
- _filedir -d
- return 0
- ;;
- -*=*) # prevent nonsense completions
- return 0
- ;;
- *)
-
- # only parse -help if senseful
- if [[ -z "$cur" || "$cur" =~ ^- ]]; then
- local helpopts
- helpopts=$($starwelsd -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
- COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
- fi
-
- # Prevent space if an argument is desired
- if [[ $COMPREPLY == *= ]]; then
- compopt -o nospace
- fi
- return 0
- ;;
- esac
- } &&
- complete -F _starwelsd starwelsd starwels-qt
-
- # Local variables:
- # mode: shell-script
- # sh-basic-offset: 4
- # sh-indent-comment: t
- # indent-tabs-mode: nil
- # End:
- # ex: ts=4 sw=4 et filetype=sh
|