_lnp-cli() { local i cur prev opts cmds COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cmd="" opts="" for i in ${COMP_WORDS[@]} do case "${i}" in "$1") cmd="lnp__cli" ;; channels) cmd+="__channels" ;; connect) cmd+="__connect" ;; funds) cmd+="__funds" ;; help) cmd+="__help" ;; info) cmd+="__info" ;; invoice) cmd+="__invoice" ;; listen) cmd+="__listen" ;; open) cmd+="__open" ;; pay) cmd+="__pay" ;; peers) cmd+="__peers" ;; ping) cmd+="__ping" ;; *) ;; esac done case "${cmd}" in lnp__cli) opts="-h -V -R -v --help --version --rpc --verbose listen connect ping info funds peers channels open invoice pay help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__channels) opts="-h -R -v --help --rpc --verbose" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__connect) opts="-h -R -v --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__funds) opts="-h -R -v --help --rpc --verbose" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__help) opts="-R -v --rpc --verbose ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__info) opts="-h -R -v --bolt --bifrost --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__invoice) opts="-h -R -v --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__listen) opts="-i -p -h -R -v --bolt --bifrost --ip --port --help --rpc --verbose" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --ip) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -i) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --port) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__open) opts="-h -R -v --pay --fee-rate --announce-channel --channel-type --dust-limit --to-self-delay --htlc-max-count --htlc-min-value --htlc-max-total-value --channel-reserve --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --pay) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --fee-rate) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --announce-channel) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --channel-type) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --dust-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --to-self-delay) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --htlc-max-count) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --htlc-min-value) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --htlc-max-total-value) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --channel-reserve) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__pay) opts="-h -R -v --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__peers) opts="-h -R -v --help --rpc --verbose" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; lnp__cli__ping) opts="-h -R -v --bolt --bifrost --help --rpc --verbose " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rpc) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; esac } complete -F _lnp-cli -o bashdefault -o default lnp-cli