mirror of
https://github.com/placeholder-soft/prodigyapi.git
synced 2026-01-12 22:44:57 +08:00
Fully parse arguments first in deploy (#1153)
* Do not build sources when using --help * Use variables for build/push if statements * fix error message
This commit is contained in:
21
deploy.sh
21
deploy.sh
@@ -36,7 +36,7 @@ parse_args() {
|
||||
while : ; do
|
||||
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
||||
echo "$help_message"
|
||||
return 0
|
||||
exit 0
|
||||
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
||||
verbose=true
|
||||
shift
|
||||
@@ -49,11 +49,22 @@ parse_args() {
|
||||
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
||||
GIT_DEPLOY_APPEND_HASH=false
|
||||
shift
|
||||
elif [[ $1 = "--source-only" ]]; then
|
||||
source_only=true
|
||||
shift
|
||||
elif [[ $1 = "--push-only" ]]; then
|
||||
push_only=true
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${source_only} ] && [ ${push_only} ]; then
|
||||
>&2 echo "You can only specify one of --source-only or --push-only"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set internal option vars from the environment and arg flags. All internal
|
||||
# vars should be declared here, with sane defaults if applicable.
|
||||
|
||||
@@ -73,8 +84,6 @@ parse_args() {
|
||||
}
|
||||
|
||||
main() {
|
||||
parse_args "$@"
|
||||
|
||||
enable_expanded_output
|
||||
|
||||
if ! git diff --exit-code --quiet --cached; then
|
||||
@@ -205,9 +214,11 @@ sanitize() {
|
||||
"$@" 2> >(filter 1>&2) | filter
|
||||
}
|
||||
|
||||
if [[ $1 = --source-only ]]; then
|
||||
parse_args "$@"
|
||||
|
||||
if [[ ${source_only} ]]; then
|
||||
run_build
|
||||
elif [[ $1 = --push-only ]]; then
|
||||
elif [[ ${push_only} ]]; then
|
||||
main "$@"
|
||||
else
|
||||
run_build
|
||||
|
||||
Reference in New Issue
Block a user