Skip to content

Commit 16bfd68

Browse files
committed
update bash-completion for v0.9
Recognize completable arguments of new and expanded commands. Now that bitcoin-cli(1) exists, add completion for it as well.
1 parent 05619d7 commit 16bfd68

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

contrib/bitcoind.bash-completion

+33-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# bash programmable completion for bitcoind(1)
2-
# Copyright (c) 2012 Christian von Roques <[email protected]>
1+
# bash programmable completion for bitcoind(1) and bitcoin-cli(1)
2+
# Copyright (c) 2012,2014 Christian von Roques <[email protected]>
33
# Distributed under the MIT/X11 software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -37,9 +37,35 @@ _bitcoind() {
3737
COMPREPLY=()
3838
_get_comp_words_by_ref -n = cur prev words cword
3939

40+
if ((cword > 4)); then
41+
case ${words[cword-4]} in
42+
signrawtransaction)
43+
COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) )
44+
return 0
45+
;;
46+
esac
47+
fi
48+
49+
if ((cword > 3)); then
50+
case ${words[cword-3]} in
51+
addmultisigaddress)
52+
_bitcoin_accounts
53+
return 0
54+
;;
55+
gettxout|importprivkey)
56+
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
57+
return 0
58+
;;
59+
esac
60+
fi
61+
4062
if ((cword > 2)); then
4163
case ${words[cword-2]} in
42-
listreceivedbyaccount|listreceivedbyaddress)
64+
addnode)
65+
COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) )
66+
return 0
67+
;;
68+
getblock|getrawtransaction|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction)
4369
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
4470
return 0
4571
;;
@@ -51,11 +77,11 @@ _bitcoind() {
5177
fi
5278

5379
case "$prev" in
54-
backupwallet)
80+
backupwallet|dumpwallet|importwallet)
5581
_filedir
5682
return 0
5783
;;
58-
setgenerate)
84+
getmempool|lockunspent|setgenerate)
5985
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
6086
return 0
6187
;;
@@ -66,7 +92,7 @@ _bitcoind() {
6692
esac
6793

6894
case "$cur" in
69-
-conf=*|-pid=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*)
95+
-conf=*|-pid=*|-loadblock=*|-wallet=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*)
7096
cur="${cur#*=}"
7197
_filedir
7298
return 0
@@ -103,7 +129,7 @@ _bitcoind() {
103129
esac
104130
}
105131

106-
complete -F _bitcoind bitcoind
132+
complete -F _bitcoind bitcoind bitcoin-cli
107133
}
108134

109135
# Local variables:

0 commit comments

Comments
 (0)