You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

starwelsd.bash-completion 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # bash programmable completion for starwelsd(1) and starwels-qt(1)
  2. # Copyright (c) 2012-2016 The Starwels developers
  3. # Distributed under the MIT software license, see the accompanying
  4. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
  5. _starwelsd() {
  6. local cur prev words=() cword
  7. local starwelsd
  8. # save and use original argument to invoke starwelsd for -help
  9. # it might not be in $PATH
  10. starwelsd="$1"
  11. COMPREPLY=()
  12. _get_comp_words_by_ref -n = cur prev words cword
  13. case "$cur" in
  14. -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*)
  15. cur="${cur#*=}"
  16. _filedir
  17. return 0
  18. ;;
  19. -datadir=*)
  20. cur="${cur#*=}"
  21. _filedir -d
  22. return 0
  23. ;;
  24. -*=*) # prevent nonsense completions
  25. return 0
  26. ;;
  27. *)
  28. # only parse -help if senseful
  29. if [[ -z "$cur" || "$cur" =~ ^- ]]; then
  30. local helpopts
  31. helpopts=$($starwelsd -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
  32. COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
  33. fi
  34. # Prevent space if an argument is desired
  35. if [[ $COMPREPLY == *= ]]; then
  36. compopt -o nospace
  37. fi
  38. return 0
  39. ;;
  40. esac
  41. } &&
  42. complete -F _starwelsd starwelsd starwels-qt
  43. # Local variables:
  44. # mode: shell-script
  45. # sh-basic-offset: 4
  46. # sh-indent-comment: t
  47. # indent-tabs-mode: nil
  48. # End:
  49. # ex: ts=4 sw=4 et filetype=sh