Skip to content

Commit

Permalink
fix showing help again for gt remote list --help
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Jun 5, 2024
1 parent 426a85d commit 5e7fdd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,21 @@ Following the output of running `gt remote list --help`:

<!-- auto-generated, do not modify here but in src/gt-remote.sh -->
```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
```

</gt-remote-list-help>
Expand Down
5 changes: 3 additions & 2 deletions src/gt-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 ""
Expand Down

0 comments on commit 5e7fdd0

Please sign in to comment.