From 3894abe211c803fa1a50840a92824e92aa31497e Mon Sep 17 00:00:00 2001 From: Luis Rascao Date: Sun, 30 Oct 2016 00:45:54 +0100 Subject: Provide per-command command line help --- priv/templates/extended_bin | 62 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'priv') diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 0881a08..63a46d1 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -31,6 +31,57 @@ REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN" ERL_OPTS="{{ erl_opts }}" RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}" +relx_usage() { + command="$1" + + case "$command" in + unpack) + echo "Usage: $REL_NAME unpack [VERSION]" + echo "Unpacks a release package VERSION, it assumes that this" + echo "release package tarball has already been deployed at one" + echo "of the following locations:" + echo " releases/-.tar.gz" + echo " releases//-.tar.gz" + echo " releases//.tar.gz" + ;; + install) + echo "Usage: $REL_NAME install [VERSION]" + echo "Installs a release package VERSION, it assumes that this" + echo "release package tarball has already been deployed at one" + echo "of the following locations:" + echo " releases/-.tar.gz" + echo " releases//-.tar.gz" + echo " releases//.tar.gz" + ;; + uninstall) + echo "Usage: $REL_NAME uninstall [VERSION]" + echo "Uninstalls a release VERSION, it will only accept" + echo "versions that are not currently in use" + ;; + upgrade) + echo "Usage: $REL_NAME upgrade [VERSION]" + echo "Upgrades the currently running release to VERSION, it assumes" + echo "that a release package tarball has already been deployed at one" + echo "of the following locations:" + echo " releases/-.tar.gz" + echo " releases//-.tar.gz" + echo " releases//.tar.gz" + ;; + downgrade) + echo "Usage: $REL_NAME downgrade [VERSION]" + echo "Downgrade the currently running release to VERSION, it assumes" + echo "that a release package tarball has already been deployed at one" + echo "of the following locations:" + echo " releases/-.tar.gz" + echo " releases//-.tar.gz" + echo " releases//.tar.gz" + ;; + *) + echo "Usage: $REL_NAME {start|start_boot |foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot |attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval}" + ;; + esac +} + find_erts_dir() { __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN" if [ -d "$__erts_dir" ]; then @@ -460,8 +511,17 @@ case "$1" in shift relx_nodetool "eval" $@ ;; + help) + if [ -z "$2" ]; then + relx_usage + exit 1 + fi + + TOPIC="$2"; shift + relx_usage $TOPIC + ;; *) - echo "Usage: $REL_NAME {start|start_boot |foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot |attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval}" + relx_usage exit 1 ;; esac -- cgit v1.2.3