-
Notifications
You must be signed in to change notification settings - Fork 24
/
autocomplete.sh
62 lines (61 loc) · 3.4 KB
/
autocomplete.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
_cardano_hw_cli_completions()
{
case $COMP_CWORD in
1)
COMPREPLY=( $(compgen -W "device version address key transaction node vote" "${COMP_WORDS[1]}") )
;;
2)
if [ "${COMP_WORDS[1]}" = "address" ]; then
COMPREPLY=( $(compgen -W "key-gen show" "${COMP_WORDS[2]}") )
fi
if [ "${COMP_WORDS[1]}" = "key" ]; then
COMPREPLY=( $(compgen -W "verification-key" "${COMP_WORDS[2]}") )
fi
if [ "${COMP_WORDS[1]}" = "transaction" ]; then
COMPREPLY=( $(compgen -W "witness policyid validate transform" "${COMP_WORDS[2]}") )
fi
if [ "${COMP_WORDS[1]}" = "device" ]; then
COMPREPLY=( $(compgen -W "version" "${COMP_WORDS[2]}") )
fi
if [ "${COMP_WORDS[1]}" = "node" ]; then
COMPREPLY=( $(compgen -W "key-gen issue-op-cert" "${COMP_WORDS[2]}") )
fi
if [ "${COMP_WORDS[1]}" = "vote" ]; then
COMPREPLY=( $(compgen -W "registration-metadata" "${COMP_WORDS[2]}") )
fi
;;
*)
if [ "${COMP_WORDS[1]}" = "address" ] && [ "${COMP_WORDS[2]}" = "key-gen" ]; then
COMPREPLY=( $(compgen -W "--path --hw-signing-file --verification-key-file --derivation-type" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "show" ]; then
COMPREPLY=( $(compgen -W "--payment-path --staking-path --address-file --derivation-type" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "verification-key" ]; then
COMPREPLY=( $(compgen -W "--hw-signing-file --verification-key-file" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "witness" ]; then
COMPREPLY=( $(compgen -W "--mainnet --testnet-magic --hw-signing-file --change-output-key-file --out-file --derivation-type" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "policyid" ]; then
COMPREPLY=( $(compgen -W "--script-file --hw-signing-file --derivation-type" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "validate" ]; then
COMPREPLY=( $(compgen -W "--tx-file" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "transform" ]; then
COMPREPLY=( $(compgen -W "--tx-file --out-file" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[1]}" = "node" ] && [ "${COMP_WORDS[2]}" = "key-gen" ]; then
COMPREPLY=( $(compgen -W "--path --hw-signing-file --cold-verification-key-file --operational-certificate-issue-counter-file" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "issue-op-cert" ]; then
COMPREPLY=( $(compgen -W "--kes-verification-key-file --kes-period --operational-certificate-issue-counter-file --hw-signing-file --out-file" -- "${COMP_WORDS[-1]}") )
fi
if [ "${COMP_WORDS[2]}" = "registration-metadata" ]; then
COMPREPLY=( $(compgen -W "--mainnet --testnet-magic --vote-public-key --payment-address --stake-signing-key --nonce --voting-purpose --payment-address-signing-key --metadata-cbor-out-file --derivation-type" -- "${COMP_WORDS[-1]}") )
fi
;;
esac
}
complete -F _cardano_hw_cli_completions cardano-hw-cli