GithubHelp home page GithubHelp logo

initaldk / bitcoin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitcoin/bitcoin

0.0 0.0 1.0 60.19 MB

Bitcoin Core integration/staging tree

Home Page: https://bitcoin.org/en/download

License: MIT License

Shell 0.66% QMake 0.04% Groff 0.36% Makefile 1.38% Python 9.59% C++ 76.00% C 10.67% HTML 1.00% CSS 0.02% Objective-C++ 0.14% Protocol Buffer 0.05% Java 0.04% Objective-C 0.04%

bitcoin's People

Contributors

casey avatar codeshark avatar cozz avatar dexx7 avatar dgenr8 avatar domob1812 avatar dooglus avatar fanquake avatar gavinandresen avatar gmaxwell avatar jonasschnelli avatar jtimon avatar kdomanski avatar laanwj avatar luke-jr avatar marcofalke avatar michagogo avatar morcos avatar muggenhor avatar non-github-bitcoin avatar paveljanik avatar petertodd avatar pstratem avatar rebroad avatar sdaftuar avatar sdkfjlsfjlskdfjlsdjflsjf avatar sipa avatar super3 avatar thebluematt avatar theuni avatar

Watchers

 avatar  avatar

Forkers

guman

bitcoin's Issues

bitcoin

bash programmable completion for bitcoind(1) and bitcoin-cli(1)

Copyright (c) 2012,2014 Christian von Roques [email protected]

Distributed under the MIT software license, see the accompanying

file COPYING or http://www.opensource.org/licenses/mit-license.php.

have bitcoind && {

call $bitcoind for RPC

bitcoin_rpc() {
# determine already specified args necessary for RPC
local rpcargs=()
for i in ${COMP_LINE}; do
case "$i" in
-conf=
|-proxy_|-rpc*)
rpcargs=( "${rpcargs[@]}" "$i" )
;;
esac
done
$bitcoind "${rpcargs[@]}" "$@"
}

Add bitcoin accounts to COMPREPLY

_bitcoin_accounts() {
local accounts
accounts=$(_bitcoin_rpc listaccounts | awk '/".*"/ { a=$1; gsub(/"/, "", a); print a}')
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) )
}

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

# save and use original argument to invoke bitcoind
# bitcoind might not be in $PATH
bitcoind="$1"

COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword

if ((cword > 4)); then
    case ${words[cword-4]} in
        listtransactions)
            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)
            _bitcoin_accounts
            return 0
            ;;
        getbalance|gettxout|importaddress|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
            ;;
        getblock|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction)
            COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
            return 0
            ;;
        move|setaccount)
            _bitcoin_accounts
            return 0
            ;;
    esac
fi

case "$prev" in
    backupwallet|dumpwallet|importwallet)
        _filedir
        return 0
        ;;
    getmempool|lockunspent|setgenerate)
        COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
        return 0
        ;;
    getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany)
        _bitcoin_accounts
        return 0
        ;;
esac

case "$cur" in
    -conf=*|-pid=*|-loadblock=*|-wallet=*)
        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=$($bitcoind --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; }')
        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 _bitcoind bitcoind bitcoin-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

Desktop version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.