bitcoin-wallet.fish raw
1 # Disable files from being included in completions by default
2 complete --command bitcoin-wallet --no-files
3
4 # Extract options
5 function __fish_bitcoin_wallet_get_options
6 set --local cmd (commandline -opc)[1]
7 for option in ($cmd -help 2>&1 | string match -r '^ -.*' | string replace -r ' -' '-' | string replace -r '=.*' '=')
8 echo $option
9 end
10 end
11
12 # Extract commands
13 function __fish_bitcoin_wallet_get_commands
14 set --local cmd (commandline -opc)[1]
15 for command in ($cmd -help | sed -e '1,/Commands:/d' -e 's/=/=\t/' -e 's/(=/=/' -e '/^ [a-z]/ p' -e d | string replace -r '\ \ ' '')
16 echo $command
17 end
18 end
19
20 # Add options
21 complete \
22 --command bitcoin-wallet \
23 --condition "not __fish_seen_subcommand_from (__fish_bitcoin_wallet_get_commands)" \
24 --arguments "(__fish_bitcoin_wallet_get_options)"
25
26 # Add commands
27 complete \
28 --command bitcoin-wallet \
29 --condition "not __fish_seen_subcommand_from (__fish_bitcoin_wallet_get_commands)" \
30 --arguments "(__fish_bitcoin_wallet_get_commands)"
31
32 # Add file completions for load and set commands
33 complete --command bitcoin-wallet \
34 --condition "string match -r -- '(dumpfile|datadir)*=' (commandline -pt)" \
35 --force-files
36