Skip to content

Commit e110beb

Browse files
committed
Add -h, --help to increment_version_tag.sh
1 parent b818732 commit e110beb

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

scripts/release/increment_version_tag.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
#!/usr/bin/env bash
22

3-
# This script should be called to tag a new release. It will take the suggested
4-
# increment (major, minor, patch) and optionally promote e.g. patch -> minor if
5-
# there are breaking changes between the previous version and the given --ref
6-
# (or HEAD).
7-
#
8-
# Usage: ./increment_version_tag.sh [--dry-run] [--ref <ref>] <--major | --minor | --patch>
9-
#
10-
# This script will create a git tag, so it should only be run in CI (or via
11-
# --dry-run).
12-
133
set -euo pipefail
144
# shellcheck source=scripts/lib.sh
155
source "$(dirname "$(dirname "${BASH_SOURCE[0]}")")/lib.sh"
166
cdroot
177

8+
usage() {
9+
cat <<EOH
10+
Usage: ./increment_version_tag.sh [--dry-run] [--ref <ref>] <--major | --minor | --patch>
11+
12+
This script should be called to tag a new release. It will take the suggested
13+
increment (major, minor, patch) and optionally promote e.g. patch -> minor if
14+
there are breaking changes between the previous version and the given --ref
15+
(or HEAD).
16+
17+
This script will create a git tag, so it should only be run in CI (or via
18+
--dry-run).
19+
EOH
20+
}
21+
1822
dry_run=0
1923
ref=HEAD
2024
increment=
2125

22-
args="$(getopt -o '' -l dry-run,ref:,major,minor,patch -- "$@")"
26+
args="$(getopt -o h -l dry-run,help,ref:,major,minor,patch -- "$@")"
2327
eval set -- "$args"
2428
while true; do
2529
case "$1" in
@@ -31,6 +35,10 @@ while true; do
3135
ref="$2"
3236
shift 2
3337
;;
38+
-h | --help)
39+
usage
40+
exit 0
41+
;;
3442
--major | --minor | --patch)
3543
if [[ -n $increment ]]; then
3644
error "Cannot specify multiple version increments."

0 commit comments

Comments
 (0)