1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-24 14:50:46 +01:00

Support -h in eclair-cli

This commit is contained in:
Andrea 2019-03-22 16:48:45 +01:00
parent 4787f0a497
commit d6f2434349
No known key found for this signature in database
GPG key ID: FFB3470FFF04CA76

View file

@ -21,6 +21,7 @@ where OPTIONS can be:
-p <password> API's password -p <password> API's password
-a <address> Override the API URL with <address> -a <address> Override the API URL with <address>
-c Outputs colored JSON -c Outputs colored JSON
-h Show available commands
and COMMAND is one of: and COMMAND is one of:
help, getinfo, connect, open, close, forceclose, updaterelayfee, help, getinfo, connect, open, close, forceclose, updaterelayfee,
@ -75,6 +76,7 @@ help() {
getinfo: returns info about the blockchain and this node getinfo: returns info about the blockchain and this node
help: display this message help: display this message
"; ";
exit 0;
} }
# -- script's logic begins here # -- script's logic begins here
@ -86,11 +88,12 @@ command -v jq >/dev/null 2>&1 || { echo -e "This tool requires jq.\nFor installa
command -v curl >/dev/null 2>&1 || { echo -e "This tool requires curl.\n\nAborting..."; exit 1; } command -v curl >/dev/null 2>&1 || { echo -e "This tool requires curl.\n\nAborting..."; exit 1; }
# extract script options # extract script options
while getopts ':cu:p:a:' flag; do while getopts ':cu:p:a:hu:' flag; do
case "${flag}" in case "${flag}" in
p) api_password="${OPTARG}" ;; p) api_password="${OPTARG}" ;;
a) api_url="${OPTARG}" ;; a) api_url="${OPTARG}" ;;
c) colors=true ;; c) colors=true ;;
h) help ;;
*) ;; *) ;;
esac esac
done done
@ -103,13 +106,11 @@ shift 1
# display a usage method if no method given # display a usage method if no method given
if [ -z $api_endpoint ]; then if [ -z $api_endpoint ]; then
usage; usage;
exit 0;
fi fi
# display a help and exit # display a help and exit
if [ "$api_endpoint" == "help" ]; then if [ "$api_endpoint" == "help" ]; then
help; help;
exit 0;
fi fi
# transform long options into a HTTP encoded url body. # transform long options into a HTTP encoded url body.