aboutsummaryrefslogtreecommitdiff
path: root/contrib/dogecoind.bash-completion
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2018-01-20 18:34:17 +0000
committerRoss Nicoll <[email protected]>2019-03-25 05:36:12 +0000
commit038ccec3e44dbfa458e00aff99a8a27fac7fb8d7 (patch)
treecb5e42279979f2c8ab8db3a46d0ab8530fc25f2f /contrib/dogecoind.bash-completion
parentrebrand dogecoin-tx test (#1450) (diff)
downloaddiscoin-038ccec3e44dbfa458e00aff99a8a27fac7fb8d7.tar.xz
discoin-038ccec3e44dbfa458e00aff99a8a27fac7fb8d7.zip
Update debian contrib files to match Dogecoin (#1449)
Diffstat (limited to 'contrib/dogecoind.bash-completion')
-rw-r--r--contrib/dogecoind.bash-completion56
1 files changed, 56 insertions, 0 deletions
diff --git a/contrib/dogecoind.bash-completion b/contrib/dogecoind.bash-completion
new file mode 100644
index 000000000..f5bed8bed
--- /dev/null
+++ b/contrib/dogecoind.bash-completion
@@ -0,0 +1,56 @@
+# bash programmable completion for dogecoind(1) and bitcoin-qt(1)
+# Copyright (c) 2012-2016 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+_dogecoind() {
+ local cur prev words=() cword
+ local dogecoind
+
+ # save and use original argument to invoke dogecoind for -help
+ # it might not be in $PATH
+ dogecoind="$1"
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n = cur prev words cword
+
+ case "$cur" in
+ -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*)
+ cur="${cur#*=}"
+ _filedir
+ return 0
+ ;;
+ -datadir=*)
+ cur="${cur#*=}"
+ _filedir -d
+ return 0
+ ;;
+ -*=*) # prevent nonsense completions
+ return 0
+ ;;
+ *)
+
+ # only parse -help if senseful
+ if [[ -z "$cur" || "$cur" =~ ^- ]]; then
+ local helpopts
+ helpopts=$($dogecoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' )
+ COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) )
+ fi
+
+ # Prevent space if an argument is desired
+ if [[ $COMPREPLY == *= ]]; then
+ compopt -o nospace
+ fi
+ return 0
+ ;;
+ esac
+} &&
+complete -F _dogecoind dogecoind bitcoin-qt
+
+# 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