mirror of https://github.com/bitcoin/bitcoin
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
3 years ago
|
# Disable files from being included in completions by default
|
||
|
complete --command bitcoind --no-files
|
||
|
|
||
|
# Extract options
|
||
|
function __fish_bitcoind_get_options
|
||
|
argparse 'nofiles' -- $argv
|
||
|
set --local cmd (commandline -opc)[1]
|
||
|
set --local options
|
||
|
|
||
|
if set -q _flag_nofiles
|
||
|
set --append options ($cmd -help-debug | string match -r '^ -.*' | string replace -r ' -' '-' | string replace -r '=.*' '=' | string match --invert -r '^.*=$')
|
||
|
else
|
||
|
set --append options ($cmd -help-debug | string match -r '^ -.*' | string replace -r ' -' '-' | string replace -r '=.*' '=' | string match -r '^.*=$')
|
||
|
end
|
||
|
|
||
|
for option in $options
|
||
|
echo $option
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
# Add options with file completion
|
||
|
complete \
|
||
|
--command bitcoind \
|
||
|
--arguments "(__fish_bitcoind_get_options)"
|
||
|
# Enable file completions only if the commandline now contains a `*.=` style option
|
||
|
complete --command bitcoind \
|
||
|
--condition 'string match --regex -- ".*=" (commandline -pt)' \
|
||
|
--force-files
|
||
|
|
||
|
# Add options without file completion
|
||
|
complete \
|
||
|
--command bitcoind \
|
||
|
--arguments "(__fish_bitcoind_get_options --nofiles)"
|
||
|
|