mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
contrib: fix up bash completion script.
$ lightning-cli <TAB><TAB> autocleaninvoice dev-slowcmd listinvoices check dev-suppress-gossip listnodes close disconnect listpayments connect feerates listpays decodepay fundchannel listpeers delexpiredinvoice getinfo listsendpays delinvoice getlog newaddr dev-compact-gossip-store getroute -o dev-crash -h --order dev-fail -H pay dev-forget-channel --help paystatus dev-ignore-htlcs help ping dev-listaddrs --human-readable --rpc-file dev-memdump invoice sendpay dev-memleak -J setchannelfee dev-query-channel-range --json stop dev-query-scids -k -V dev-reenable-commit --keywords --version dev-rescan-outputs --lightning-dir waitanyinvoice dev-rhash listchannels waitinvoice dev-send-timestamp-filter listconfigs waitsendpay dev-set-max-scids-encode-size listforwards withdraw dev-sign-last-tx listfunds Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -25,13 +25,13 @@ _lightning_cli() {
|
|||||||
|
|
||||||
# get the global options, starting with --
|
# get the global options, starting with --
|
||||||
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
|
if [[ -z "$cur" || "$cur" =~ ^- ]]; then
|
||||||
globalcmds=$($lightning_cli --help 2>&1 | awk '$1 ~ /^-/ { sub(/,/, ""); print $1}')
|
globalcmds=$($lightning_cli --help 2>&1 | tr '|' '\n' | sed -n -e 's/ .*//' -e 's/\(-[-a-z0-9A-Z]*\).*/\1/p')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# get the regular commands
|
# get the regular commands
|
||||||
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
|
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
|
||||||
helpopts=$($lightning_cli -H help 2>/dev/null | sed -n 's/^[a-z]/&/p' | sed '$ d')
|
helpopts=$($lightning_cli -H help 2>/dev/null | sed -n 's/^\([a-z][a-z-]*\).*/\1/p' | sed '$ d')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "$helpopts $globalcmds" -X "*," -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$helpopts $globalcmds" -X "*," -- "$cur" ) )
|
||||||
|
|||||||
Reference in New Issue
Block a user