forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from syscoin/dev-3.x
Dev 3.x Former-commit-id: 79c3a0a
- Loading branch information
Showing
606 changed files
with
5,298 additions
and
2,861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,4 @@ syscoin-cli | |
syscoind | ||
syscoin-qt | ||
make | ||
contrib/devtools/split-debug.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This function checks whether we have a given program on the system. | ||
# https://stackoverflow.com/a/12874971/1427161 | ||
# | ||
_have() | ||
{ | ||
# Completions for system administrator commands are installed as well in | ||
# case completion is attempted via `sudo command ...'. | ||
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null | ||
} | ||
|
||
# Backwards compatibility for compat completions that use have(). | ||
# @deprecated should no longer be used; generally not needed with dynamically | ||
# loaded completions, and _have is suitable for runtime use. | ||
have() | ||
{ | ||
unset -v have | ||
_have $1 && have=yes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Bash Completion | ||
--------------------- | ||
|
||
The following script provide bash completion functionality for `sycoind` and `syscoin-cli`. | ||
|
||
* `contrib/syscoind.bash-completion` | ||
* `contrib/syscoin-cli.bash-completion` | ||
* `contrib/_osx.bash-completion` | ||
|
||
### OSX ### | ||
Use `brew` to install `bash-completion` then update `~/.bashrc` to include the completion scripts and helper functions to provide `have()` and `_have()` on OSX. | ||
|
||
The example assumes Syscoin was compiled in `~/syscoin` and the scripts will be availabe in `~/syscoin/contrib`, however they can be moved to a different location. | ||
|
||
``` | ||
brew install bash bash-completion | ||
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' | ||
chsh -s /usr/local/bin/bash | ||
BASHRC=$(cat <<EOF | ||
if [ -f $(brew --prefix)/etc/bash_completion ]; then | ||
. $(brew --prefix)/etc/bash_completion | ||
fi | ||
. ~/syscoin/contrib/_osx.bash-completion | ||
. ~/syscoin/contrib/syscoind.bash-completion | ||
. ~/syscoin/contrib/syscoin-cli.bash-completion | ||
EOF | ||
) | ||
grep -q "/etc/bash_completion" ~/.bashrc || echo "$BASHRC" >> ~/.bashrc | ||
. ~/.bashrc | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
contrib/syscoind.bash-completion syscoind | ||
contrib/syscoin-cli.bash-completion syscoin-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
# bash programmable completion for syscoin-cli(1) | ||
# Copyright (c) 2012-2016 The Bitcoin Core developers | ||
# Copyright (c) 2014-2018 The Syscoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
# call $syscoin-cli for RPC | ||
_syscoin_rpc() { | ||
# determine already specified args necessary for RPC | ||
local rpcargs=() | ||
for i in ${COMP_LINE}; do | ||
case "$i" in | ||
-conf=*|-datadir=*|-regtest|-rpc*|-testnet) | ||
rpcargs=( "${rpcargs[@]}" "$i" ) | ||
;; | ||
esac | ||
done | ||
$syscoin_cli "${rpcargs[@]}" "$@" | ||
} | ||
|
||
# Add wallet accounts to COMPREPLY | ||
_syscoin_accounts() { | ||
local accounts | ||
accounts=$(_syscoin_rpc listaccounts | awk -F '"' '{ print $2 }') | ||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) ) | ||
} | ||
|
||
_syscoin_cli() { | ||
local cur prev words=() cword | ||
local syscoin_cli | ||
|
||
# save and use original argument to invoke syscoin-cli for -help, help and RPC | ||
# as syscoin-cli might not be in $PATH | ||
syscoin_cli="$1" | ||
|
||
COMPREPLY=() | ||
_get_comp_words_by_ref -n = cur prev words cword | ||
|
||
if ((cword > 5)); then | ||
case ${words[cword-5]} in | ||
sendtoaddress) | ||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
esac | ||
fi | ||
|
||
if ((cword > 4)); then | ||
case ${words[cword-4]} in | ||
importaddress|listtransactions|setban) | ||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
signrawtransaction) | ||
COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
esac | ||
fi | ||
|
||
if ((cword > 3)); then | ||
case ${words[cword-3]} in | ||
addmultisigaddress) | ||
_syscoin_accounts | ||
return 0 | ||
;; | ||
getbalance|gettxout|importaddress|importpubkey|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock) | ||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
esac | ||
fi | ||
|
||
if ((cword > 2)); then | ||
case ${words[cword-2]} in | ||
addnode) | ||
COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
setban) | ||
COMPREPLY=( $( compgen -W "add remove" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
fundrawtransaction|getblock|getblockheader|getmempoolancestors|getmempooldescendants|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction) | ||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
move|setaccount) | ||
_syscoin_accounts | ||
return 0 | ||
;; | ||
esac | ||
fi | ||
|
||
if ((cword > 1)); then | ||
case ${words[cword-1]} in | ||
gobject) | ||
COMPREPLY=( $( compgen -W "check prepare submit deserialize count get getvotes getcurrentvotes list diff vote-name vote-conf vote-many" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
masternode) | ||
COMPREPLY=( $( compgen -W "count current genkey outputs initialize start-all start-missing start-disabled status list list-conf winner winners" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
masternodelist) | ||
COMPREPLY=( $( compgen -W "activeseconds addr daemon full info json lastpaidblock lastpaidtime lastseen payee protocol pubkey rank sentinel status" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
masternodebroadcast) | ||
COMPREPLY=( $( compgen -W "create-name create-all decode relay" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
mnsync) | ||
COMPREPLY=( $( compgen -W "status next reset" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
privatesend) | ||
COMPREPLY=( $( compgen -W "start stop reset" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
*) | ||
printf "\n\n" | ||
"$syscoin_cli" help ${words[1]} | ||
printf ">" | ||
printf " %s" "${words[@]}" | ||
return 0 | ||
;; | ||
esac | ||
fi | ||
|
||
case "$prev" in | ||
backupwallet|dumpwallet|importwallet) | ||
_filedir | ||
return 0 | ||
;; | ||
getaddednodeinfo|getrawmempool|lockunspent|setgenerate) | ||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) | ||
return 0 | ||
;; | ||
getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany) | ||
_syscoin_accounts | ||
return 0 | ||
;; | ||
esac | ||
|
||
case "$cur" in | ||
-conf=*) | ||
cur="${cur#*=}" | ||
_filedir | ||
return 0 | ||
;; | ||
-datadir=*) | ||
cur="${cur#*=}" | ||
_filedir -d | ||
return 0 | ||
;; | ||
-*=*) # prevent nonsense completions | ||
return 0 | ||
;; | ||
*) | ||
local helpopts commands | ||
|
||
# only parse -help if senseful | ||
if [[ -z "$cur" || "$cur" =~ ^- ]]; then | ||
helpopts=$($syscoin_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) | ||
fi | ||
|
||
# only parse help if senseful | ||
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then | ||
commands=$(_syscoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') | ||
fi | ||
|
||
COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) | ||
|
||
# Prevent space if an argument is desired | ||
if [[ $COMPREPLY == *= ]]; then | ||
compopt -o nospace | ||
fi | ||
return 0 | ||
;; | ||
esac | ||
} && | ||
complete -F _syscoin_cli syscoin-cli | ||
|
||
# Local variables: | ||
# mode: shell-script | ||
# sh-basic-offset: 4 | ||
# sh-indent-comment: t | ||
# indent-tabs-mode: nil | ||
# End: | ||
# ex: ts=4 sw=4 et filetype=sh |
Oops, something went wrong.