Skip to content

Commit a8d530f

Browse files
committed
-h/--help options for deploy.sh and sync.sh
1 parent d270204 commit a8d530f

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

support/build/_util/deploy.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ set -o pipefail
55
# fail harder
66
set -eu
77

8+
help=false
9+
810
publish=false
911

1012
# process flags
11-
optstring=":-:"
13+
optstring=":-:h"
1214
while getopts "$optstring" opt; do
1315
case $opt in
16+
h)
17+
help=true
18+
;;
1419
-)
1520
case "$OPTARG" in
21+
help)
22+
help=true
23+
;;
1624
publish)
1725
publish=true
1826
break
@@ -27,7 +35,7 @@ done
2735
# clear processed "publish" argument
2836
shift $((OPTIND-1))
2937

30-
if [[ $# -lt 1 ]]; then
38+
if $help || [[ $# -lt 1 ]]; then
3139
cat >&2 <<-EOF
3240
Usage: $(basename "$0") [--publish] FORMULA-VERSION [--overwrite]
3341
If --publish is given, mkrepo.sh will be invoked after a successful deploy to

support/build/_util/sync.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ set -o pipefail
1010
# when using --progress, no output goes to stdout, but errors are mixed with progress info
1111
S5CMD_OPTIONS=(${S5CMD_NO_SIGN_REQUEST:+--no-sign-request} ${S5CMD_PROFILE:+--profile "${S5CMD_PROFILE}"} --log error)
1212

13+
help=false
14+
1315
checksum=
1416

1517
localsrc=
@@ -18,9 +20,12 @@ localdst=
1820
remove=true
1921

2022
# process flags
21-
optstring=":-:c:d:s:"
23+
optstring=":-:hc:d:s:"
2224
while getopts "$optstring" opt; do
2325
case $opt in
26+
h)
27+
help=true
28+
;;
2429
c)
2530
checksum=$OPTARG
2631
;;
@@ -32,6 +37,9 @@ while getopts "$optstring" opt; do
3237
;;
3338
-)
3439
case "$OPTARG" in
40+
help)
41+
help=true
42+
;;
3543
no-remove)
3644
remove=false
3745
;;
@@ -45,7 +53,7 @@ done
4553
# clear processed arguments
4654
shift $((OPTIND-1))
4755

48-
if [[ $# -lt "2" || $# -gt "6" ]]; then
56+
if $help || [[ $# -lt "2" || $# -gt "6" ]]; then
4957
cat >&2 <<-EOF
5058
Usage: $(basename "$0") [--no-remove] [-c CHECKSUM] [-d DEST_DIR] [-s SRC_DIR] DEST_BUCKET DEST_PREFIX [DEST_REGION [SOURCE_BUCKET SOURCE_PREFIX [SOURCE_REGION]]]
5159
DEST_BUCKET: destination S3 bucket name.

0 commit comments

Comments
 (0)