Skip to content

Commit a7badff

Browse files
author
Matt Pearson
committed
Add positional args for directory, branch, and repository.
This implements '[<options>] [<directory> [<branch> [<repository]]]' but requires all <options> come before the positional args.
1 parent f920e3f commit a7badff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

deploy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ main() {
1111
append_hash=true
1212

1313
# Parse arg flags
14+
# [<options>] [<directory> [<branch> [<repository]]]
1415
while : ; do
1516
if [[ $1 = "-v" || $1 = "--verbose" ]]; then
1617
verbose=true
@@ -27,6 +28,16 @@ main() {
2728
elif [[ $1 = "-c" || $1 = "--config-file" ]]; then
2829
source "$2"
2930
shift 2
31+
elif [[ -n ${1} ]]; then
32+
# Set positional args
33+
deploy_directory=$1
34+
if [[ -n $2 ]]; then
35+
deploy_branch=$2
36+
fi
37+
if [[ -n $3 ]]; then
38+
repo=$3
39+
fi
40+
break
3041
else
3142
break
3243
fi

0 commit comments

Comments
 (0)