]> Git Repo - VerusCoin.git/blame - contrib/zcash-tx.bash-completion
Update contrib/debian/copyright for ax_boost_thread.m4
[VerusCoin.git] / contrib / zcash-tx.bash-completion
CommitLineData
e619c219 1# bash programmable completion for zcash-tx(1)
c794f6d3
CR
2# Copyright (c) 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.
5
e619c219 6_zcash_tx() {
c794f6d3 7 local cur prev words=() cword
e619c219 8 local zcash_tx
c794f6d3 9
e619c219 10 # save and use original argument to invoke zcash-tx for -help
c794f6d3 11 # it might not be in $PATH
e619c219 12 zcash_tx="$1"
c794f6d3
CR
13
14 COMPREPLY=()
15 _get_comp_words_by_ref -n =: cur prev words cword
16
17 case "$cur" in
18 load=*:*)
19 cur="${cur#load=*:}"
20 _filedir
21 return 0
22 ;;
23 *=*) # prevent attempts to complete other arguments
24 return 0
25 ;;
26 esac
27
28 if [[ "$cword" == 1 || ( "$prev" != "-create" && "$prev" == -* ) ]]; then
29 # only options (or an uncompletable hex-string) allowed
e619c219 30 # parse zcash-tx -help for options
c794f6d3 31 local helpopts
e619c219 32 helpopts=$($zcash_tx -help | sed -e '/^ -/ p' -e d )
c794f6d3
CR
33 COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
34 else
35 # only commands are allowed
36 # parse -help for commands
37 local helpcmds
e619c219 38 helpcmds=$($zcash_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d )
c794f6d3
CR
39 COMPREPLY=( $( compgen -W "$helpcmds" -- "$cur" ) )
40 fi
41
42 # Prevent space if an argument is desired
43 if [[ $COMPREPLY == *= ]]; then
44 compopt -o nospace
45 fi
46
47 return 0
48} &&
e619c219 49complete -F _zcash_tx zcash-tx
c794f6d3
CR
50
51# Local variables:
52# mode: shell-script
53# sh-basic-offset: 4
54# sh-indent-comment: t
55# indent-tabs-mode: nil
56# End:
57# ex: ts=4 sw=4 et filetype=sh
This page took 0.071375 seconds and 4 git commands to generate.