1 # bash programmable completion for bitcoind(1) and bitcoin-qt(1)
2 # Copyright (c) 2012-2016 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 local cur prev words=() cword
10 # save and use original argument to invoke bitcoind for -help
11 # it might not be in $PATH
15 _get_comp_words_by_ref -n = cur prev words cword
18 -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*)
28 -*=*) # prevent nonsense completions
33 # only parse -help if sensible
34 if [[ -z "$cur" || "$cur" =~ ^- ]]; then
36 helpopts=$($bitcoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
37 COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
40 # Prevent space if an argument is desired
41 if [[ $COMPREPLY == *= ]]; then
48 complete -F _bitcoind bitcoind bitcoin-qt
53 # sh-indent-comment: t
54 # indent-tabs-mode: nil
56 # ex: ts=4 sw=4 et filetype=sh