feat(help): add detailed usage instructions and help flag to merge-pull-requests-by-title.sh#164
Merged
joshjohanning merged 2 commits intomainfrom Apr 15, 2026
Merged
Conversation
…ll-requests-by-title.sh
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a dedicated --help/-h flow to gh-cli/merge-pull-requests-by-title.sh so users can discover supported invocation modes, positional args, and flags directly from the script.
Changes:
- Introduces a
print_help()function with detailed usage/flags/examples - Adds
-h/--helphandling to exit early after printing help - Replaces the “too few args” usage block with a
print_helpcall
Comments suppressed due to low confidence (1)
gh-cli/merge-pull-requests-by-title.sh:154
- The argument parser only errors on unknown long options (
--*). With-hnow supported, other unknown short options (e.g.,-x) will be treated as positional args and can lead to confusing failures later. Consider explicitly rejecting unknown-*flags (or supporting--end-of-options) and showing the valid flags/help output.
while [ $i -lt ${#args[@]} ]; do
arg="${args[$i]}"
if [ "$arg" = "--help" ] || [ "$arg" = "-h" ]; then
print_help
exit 0
elif [ "$arg" = "--dry-run" ]; then
dry_run=true
elif [ "$arg" = "--bump-patch-version" ]; then
bump_patch_version=true
elif [ "$arg" = "--enable-auto-merge" ]; then
enable_auto_merge=true
elif [ "$arg" = "--no-prompt" ]; then
no_prompt=true
elif [ "$arg" = "--owner" ]; then
((i++))
search_owner="${args[$i]}"
if [ -z "$search_owner" ] || [[ "$search_owner" == --* ]]; then
echo "Error: --owner requires a value"
exit 1
fi
if ! [[ "$search_owner" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "Error: Invalid owner '$search_owner' - must be a valid GitHub username or organization"
exit 1
fi
elif [ "$arg" = "--topic" ]; then
((i++))
topic_val="${args[$i]}"
if [ -z "$topic_val" ] || [[ "$topic_val" == --* ]]; then
echo "Error: --topic requires a value"
exit 1
fi
topics+=("$topic_val")
elif [[ "$arg" == --* ]]; then
echo "Error: Unknown flag '$arg'"
echo "Valid flags: ${valid_flags[*]}"
exit 1
fi
Update help text to note that --bump-patch-version only bumps/commits/pushes and does not merge PRs unless combined with --enable-auto-merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding a
--helpflag to help with input options