mirror of
https://github.com/placeholder-soft/prodigyapi.git
synced 2026-04-30 04:45:02 +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
|
while : ; do
|
||||||
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
||||||
echo "$help_message"
|
echo "$help_message"
|
||||||
return 0
|
exit 0
|
||||||
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
||||||
verbose=true
|
verbose=true
|
||||||
shift
|
shift
|
||||||
@@ -49,11 +49,22 @@ parse_args() {
|
|||||||
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
||||||
GIT_DEPLOY_APPEND_HASH=false
|
GIT_DEPLOY_APPEND_HASH=false
|
||||||
shift
|
shift
|
||||||
|
elif [[ $1 = "--source-only" ]]; then
|
||||||
|
source_only=true
|
||||||
|
shift
|
||||||
|
elif [[ $1 = "--push-only" ]]; then
|
||||||
|
push_only=true
|
||||||
|
shift
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
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
|
# Set internal option vars from the environment and arg flags. All internal
|
||||||
# vars should be declared here, with sane defaults if applicable.
|
# vars should be declared here, with sane defaults if applicable.
|
||||||
|
|
||||||
@@ -73,8 +84,6 @@ parse_args() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
parse_args "$@"
|
|
||||||
|
|
||||||
enable_expanded_output
|
enable_expanded_output
|
||||||
|
|
||||||
if ! git diff --exit-code --quiet --cached; then
|
if ! git diff --exit-code --quiet --cached; then
|
||||||
@@ -205,9 +214,11 @@ sanitize() {
|
|||||||
"$@" 2> >(filter 1>&2) | filter
|
"$@" 2> >(filter 1>&2) | filter
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 = --source-only ]]; then
|
parse_args "$@"
|
||||||
|
|
||||||
|
if [[ ${source_only} ]]; then
|
||||||
run_build
|
run_build
|
||||||
elif [[ $1 = --push-only ]]; then
|
elif [[ ${push_only} ]]; then
|
||||||
main "$@"
|
main "$@"
|
||||||
else
|
else
|
||||||
run_build
|
run_build
|
||||||
|
|||||||
Reference in New Issue
Block a user