Skip to content

Commit

Permalink
Rename qtum files
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed May 31, 2024
1 parent 84af076 commit 3ef33b5
Show file tree
Hide file tree
Showing 125 changed files with 108 additions and 21,441 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# bash programmable completion for bitcoin-cli(1)
# bash programmable completion for qtum-cli(1)
# Copyright (c) 2012-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

# call $bitcoin-cli for RPC
_bitcoin_rpc() {
# call $qtum-cli for RPC
_qtum_rpc() {
# determine already specified args necessary for RPC
local rpcargs=()
for i in ${COMP_LINE}; do
Expand All @@ -14,16 +14,16 @@ _bitcoin_rpc() {
;;
esac
done
$bitcoin_cli "${rpcargs[@]}" "$@"
$qtum_cli "${rpcargs[@]}" "$@"
}

_bitcoin_cli() {
_qtum_cli() {
local cur prev words=() cword
local bitcoin_cli
local qtum_cli

# save and use original argument to invoke bitcoin-cli for -help, help and RPC
# as bitcoin-cli might not be in $PATH
bitcoin_cli="$1"
# save and use original argument to invoke qtum-cli for -help, help and RPC
# as qtum-cli might not be in $PATH
qtum_cli="$1"

COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
Expand Down Expand Up @@ -112,12 +112,12 @@ _bitcoin_cli() {

# only parse -help if senseful
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
helpopts=$($bitcoin_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
helpopts=$($qtum_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
fi

# only parse help if senseful
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }')
commands=$(_qtum_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }')
fi

COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) )
Expand All @@ -130,7 +130,7 @@ _bitcoin_cli() {
;;
esac
} &&
complete -F _bitcoin_cli bitcoin-cli
complete -F _qtum_cli qtum-cli

# Local variables:
# mode: shell-script
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# bash programmable completion for bitcoin-tx(1)
# bash programmable completion for qtum-tx(1)
# Copyright (c) 2016-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

_bitcoin_tx() {
_qtum_tx() {
local cur prev words=() cword
local bitcoin_tx
local qtum_tx

# save and use original argument to invoke bitcoin-tx for -help
# save and use original argument to invoke qtum-tx for -help
# it might not be in $PATH
bitcoin_tx="$1"
qtum_tx="$1"

COMPREPLY=()
_get_comp_words_by_ref -n =: cur prev words cword
Expand All @@ -27,15 +27,15 @@ _bitcoin_tx() {

if [[ "$cword" == 1 || ( "$prev" != "-create" && "$prev" == -* ) ]]; then
# only options (or an uncompletable hex-string) allowed
# parse bitcoin-tx -help for options
# parse qtum-tx -help for options
local helpopts
helpopts=$($bitcoin_tx -help | sed -e '/^ -/ p' -e d )
helpopts=$($qtum_tx -help | sed -e '/^ -/ p' -e d )
COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
else
# only commands are allowed
# parse -help for commands
local helpcmds
helpcmds=$($bitcoin_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d )
helpcmds=$($qtum_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d )
COMPREPLY=( $( compgen -W "$helpcmds" -- "$cur" ) )
fi

Expand All @@ -46,7 +46,7 @@ _bitcoin_tx() {

return 0
} &&
complete -F _bitcoin_tx bitcoin-tx
complete -F _qtum_tx qtum-tx

# Local variables:
# mode: shell-script
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# bash programmable completion for bitcoind(1) and bitcoin-qt(1)
# bash programmable completion for qtumd(1) and qtum-qt(1)
# Copyright (c) 2012-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

_bitcoind() {
_qtumd() {
local cur prev words=() cword
local bitcoind
local qtumd

# save and use original argument to invoke bitcoind for -help
# save and use original argument to invoke qtumd for -help
# it might not be in $PATH
bitcoind="$1"
qtumd="$1"

COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
Expand All @@ -33,7 +33,7 @@ _bitcoind() {
# only parse -help if sensible
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
local helpopts
helpopts=$($bitcoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
helpopts=$($qtumd -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
fi

Expand All @@ -45,7 +45,7 @@ _bitcoind() {
;;
esac
} &&
complete -F _bitcoind bitcoind bitcoin-qt
complete -F _qtumd qtumd qtum-qt

# Local variables:
# mode: shell-script
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Disable files from being included in completions by default
complete --command bitcoin-cli --no-files
complete --command qtum-cli --no-files

function __fish_bitcoin_cli_get_commands_helper
function __fish_qtum_cli_get_commands_helper
set --local cmd (commandline -oc)

# Don't return commands if '-help or -?' in commandline
Expand All @@ -21,22 +21,22 @@ function __fish_bitcoin_cli_get_commands_helper
end
end

function __fish_bitcoin_cli_get_commands
function __fish_qtum_cli_get_commands
argparse 'nohelp' 'commandsonly' -- $argv
set --local commands

# Exclude description, exclude help
if set -q _flag_nohelp; and set -q _flag_commandsonly
set --append commands (__fish_bitcoin_cli_get_commands_helper | string replace -r ' .*$' '' | string match --invert -r 'help')
set --append commands (__fish_qtum_cli_get_commands_helper | string replace -r ' .*$' '' | string match --invert -r 'help')
# Include description, exclude help
else if set -q _flag_nohelp
set --append commands (__fish_bitcoin_cli_get_commands_helper | string replace ' ' \t | string match --invert -r 'help')
set --append commands (__fish_qtum_cli_get_commands_helper | string replace ' ' \t | string match --invert -r 'help')
# Exclude description, include help
else if set -q _flag_commandsonly
set --append commands (__fish_bitcoin_cli_get_commands_helper | string replace -r ' .*$' '')
set --append commands (__fish_qtum_cli_get_commands_helper | string replace -r ' .*$' '')
# Include description, include help
else
set --append commands (__fish_bitcoin_cli_get_commands_helper | string replace ' ' \t)
set --append commands (__fish_qtum_cli_get_commands_helper | string replace ' ' \t)
end

if string match -q -r '^.*error.*$' $commands[1]
Expand All @@ -50,7 +50,7 @@ function __fish_bitcoin_cli_get_commands
end


function __fish_bitcoin_cli_get_options
function __fish_qtum_cli_get_options
argparse 'nofiles' -- $argv
set --local cmd (commandline -oc)
# Don't return options if '-help or -?' in commandline
Expand All @@ -73,27 +73,27 @@ end
# Add options with file completion
# Don't offer after a command is given
complete \
--command bitcoin-cli \
--command qtum-cli \
--no-files \
--condition "not __fish_seen_subcommand_from (__fish_bitcoin_cli_get_commands --commandsonly)" \
--arguments "(__fish_bitcoin_cli_get_options)"
--condition "not __fish_seen_subcommand_from (__fish_qtum_cli_get_commands --commandsonly)" \
--arguments "(__fish_qtum_cli_get_options)"
# Enable file completions only if the commandline now contains a `*.=` style option
complete --command bitcoin-cli \
complete --command qtum-cli \
--condition 'string match --regex -- ".*=" (commandline -pt)' \
--force-files

# Add options without file completion
# Don't offer after a command is given
complete \
--command bitcoin-cli \
--command qtum-cli \
--no-files \
--condition "not __fish_seen_subcommand_from (__fish_bitcoin_cli_get_commands --commandsonly)" \
--arguments "(__fish_bitcoin_cli_get_options --nofiles)"
--condition "not __fish_seen_subcommand_from (__fish_qtum_cli_get_commands --commandsonly)" \
--arguments "(__fish_qtum_cli_get_options --nofiles)"

# Add commands
# Permit command completions after `bitcoin-cli help` but not after other commands
# Permit command completions after `qtum-cli help` but not after other commands
complete \
--command bitcoin-cli \
--command qtum-cli \
--no-files \
--condition "not __fish_seen_subcommand_from (__fish_bitcoin_cli_get_commands --commandsonly --nohelp)" \
--arguments "(__fish_bitcoin_cli_get_commands)"
--condition "not __fish_seen_subcommand_from (__fish_qtum_cli_get_commands --commandsonly --nohelp)" \
--arguments "(__fish_qtum_cli_get_commands)"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Disable files from being included in completions by default
complete --command bitcoind --no-files
complete --command qtum-qt --no-files

# Extract options
function __fish_bitcoind_get_options
function __fish_qtumqt_get_options
argparse 'nofiles' -- $argv
set --local cmd (commandline -opc)[1]
set --local options
Expand All @@ -21,15 +21,15 @@ end

# Add options with file completion
complete \
--command bitcoind \
--arguments "(__fish_bitcoind_get_options)"
--command qtum-qt \
--arguments "(__fish_qtumqt_get_options)"
# Enable file completions only if the commandline now contains a `*.=` style option
complete --command bitcoind \
complete -c qtum-qt \
--condition 'string match --regex -- ".*=" (commandline -pt)' \
--force-files

# Add options without file completion
complete \
--command bitcoind \
--arguments "(__fish_bitcoind_get_options --nofiles)"
--command qtum-qt \
--arguments "(__fish_qtumqt_get_options --nofiles)"

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Disable files from being included in completions by default
complete --command bitcoin-tx --no-files
complete --command qtum-tx --no-files

# Modified version of __fish_seen_subcommand_from
# Uses regex to detect cmd= syntax
function __fish_bitcoin_seen_cmd
function __fish_qtum_seen_cmd
set -l cmd (commandline -oc)
set -e cmd[1]
for i in $cmd
Expand All @@ -17,7 +17,7 @@ function __fish_bitcoin_seen_cmd
end

# Extract options
function __fish_bitcoin_tx_get_options
function __fish_qtum_tx_get_options
set --local cmd (commandline -oc)[1]
if string match --quiet --regex -- '^-help$|-\?$' $cmd
return
Expand All @@ -29,7 +29,7 @@ function __fish_bitcoin_tx_get_options
end

# Extract commands
function __fish_bitcoin_tx_get_commands
function __fish_qtum_tx_get_commands
argparse 'commandsonly' -- $argv
set --local cmd (commandline -oc)[1]
set --local commands
Expand All @@ -47,19 +47,19 @@ end

# Add options
complete \
--command bitcoin-tx \
--condition "not __fish_bitcoin_seen_cmd (__fish_bitcoin_tx_get_commands --commandsonly)" \
--arguments "(__fish_bitcoin_tx_get_options)" \
--command qtum-tx \
--condition "not __fish_qtum_seen_cmd (__fish_qtum_tx_get_commands --commandsonly)" \
--arguments "(__fish_qtum_tx_get_options)" \
--no-files

# Add commands
complete \
--command bitcoin-tx \
--arguments "(__fish_bitcoin_tx_get_commands)" \
--command qtum-tx \
--arguments "(__fish_qtum_tx_get_commands)" \
--no-files

# Add file completions for load and set commands
complete \
--command bitcoin-tx \
--command qtum-tx \
--condition 'string match --regex -- "(load|set)=" (commandline -pt)' \
--force-files
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Disable files from being included in completions by default
complete --command bitcoin-util --no-files
complete --command qtum-util --no-files

# Extract options
function __fish_bitcoin_util_get_options
function __fish_qtum_util_get_options
set --local cmd (commandline -opc)[1]
set --local options

Expand All @@ -14,7 +14,7 @@ function __fish_bitcoin_util_get_options
end

# Extract commands
function __fish_bitcoin_util_get_commands
function __fish_qtum_util_get_commands
set --local cmd (commandline -opc)[1]
set --local commands

Expand All @@ -26,13 +26,13 @@ end

# Add options
complete \
--command bitcoin-util \
--condition "not __fish_seen_subcommand_from (__fish_bitcoin_util_get_commands)" \
--arguments "(__fish_bitcoin_util_get_options)"
--command qtum-util \
--condition "not __fish_seen_subcommand_from (__fish_qtum_util_get_commands)" \
--arguments "(__fish_qtum_util_get_options)"

# Add commands
complete \
--command bitcoin-util \
--condition "not __fish_seen_subcommand_from (__fish_bitcoin_util_get_commands)" \
--arguments "(__fish_bitcoin_util_get_commands)"
--command qtum-util \
--condition "not __fish_seen_subcommand_from (__fish_qtum_util_get_commands)" \
--arguments "(__fish_qtum_util_get_commands)"

Loading

0 comments on commit 3ef33b5

Please sign in to comment.