Created
March 28, 2019 03:57
-
-
Save yunyu950908/878455bbcfa5243cfe4aecf3185f7bf6 to your computer and use it in GitHub Desktop.
launcher.sh with args
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
package="dev-launcher" | |
app="*" | |
page="*" | |
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) | |
echo "$package - development server launcher" | |
echo " " | |
echo "$package [options] [arguments]" | |
echo " " | |
echo "options:" | |
echo "-h, --help show brief help" | |
echo "-a, --app specify apps' directory name" | |
echo "-p, --page specify pages' directory name" | |
echo "example: " | |
echo " $ dev-launcher -a monitor" | |
echo " $ dev-launcher -p settings,edit_alert" | |
exit 0 | |
;; | |
-a|--app) | |
shift | |
if test $# -gt 0; then | |
app="$1" | |
else | |
echo "no app's dir name specified" | |
exit 1 | |
fi | |
shift | |
;; | |
-p|--page) | |
shift | |
if test $# -gt 0; then | |
page="$1" | |
else | |
echo "no page's dir name specified" | |
exit 1 | |
fi | |
shift | |
;; | |
*) | |
break | |
;; | |
esac | |
done | |
echo "app=$app" | |
echo "page=$page" | |
npm run dev -- --env.app=$app --env.page=$page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment