From 5e7fdd0ea8e62465bed3203cb76b2652a8ae5a9f Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Wed, 5 Jun 2024 22:40:54 +0200 Subject: [PATCH] fix showing help again for gt remote list --help --- README.md | 14 ++++++++++++++ src/gt-remote.sh | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 465e8a34..2ef45432 100644 --- a/README.md +++ b/README.md @@ -358,7 +358,21 @@ Following the output of running `gt remote list --help`: ```text +Parameters: +-w|--working-directory (optional) path which gt shall use as working directory -- default: .gt + +--help prints this help +--version prints the version of this script + +Examples: +# lists all defined remotes in .gt +gt remote list + +# uses a custom working directory +gt remote list -w .github/.gt +INFO: Version of gt-remote.sh is: +v0.18.0-SNAPSHOT ``` diff --git a/src/gt-remote.sh b/src/gt-remote.sh index a2513ee3..9ed847cd 100755 --- a/src/gt-remote.sh +++ b/src/gt-remote.sh @@ -206,7 +206,7 @@ function gt_remote_list_raw() { EOM ) - parseArguments params "$examples" "$GT_VERSION" "$@" + parseArguments params "$examples" "$GT_VERSION" "$@" || return $? if ! [[ -v workingDir ]]; then workingDir="$defaultWorkingDir"; fi exitIfNotAllArgumentsSet params "$examples" "$GT_VERSION" @@ -228,7 +228,8 @@ function gt_remote_list_raw() { function gt_remote_list() { local output - output=$(gt_remote_list_raw "$@") + # shellcheck disable=SC2310 # we are aware of that || will disable set -e, that's what we want + output=$(gt_remote_list_raw "$@") || [[ $? -eq 99 ]] # ignore if user used --help (returns 99), fail otherwise if [[ $output == "" ]]; then logInfo "No remote defined yet." echo ""