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