-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest-details.sh
More file actions
50 lines (42 loc) · 1.25 KB
/
request-details.sh
File metadata and controls
50 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Retrieve arguments
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "Options:"
echo "-h, --help Show brief help"
echo "-a, --appname Specify an app name being generated"
exit 0
;;
-a|--appname*)
shift
APP_NAME=$1
shift
;;
*)
break
;;
esac
done
CREDENTIALS_FILE="./project-details.txt"
# If credential file does not exist
# Ask for details then store in credentials.txt
if [ ! -f $CREDENTIALS_FILE ]; then
# Ask for project ID
read -p $'\e[32m?\e[0m Please input Firebase project ID to use: \e[36m' PROJECT_ID
# Create credentials.txt
cat <<EOF > $CREDENTIALS_FILE
PROJECT_ID=$PROJECT_ID
EOF
# Ask for owner name
read -p $'\e[32m?\e[0m Please input the ORG/OWNER name. This will be used for naming convention for the app as "com.OWNER.appname": \e[36m' OWNER_NAME
# Add owner name in credentials.txt
cat <<EOF >> $CREDENTIALS_FILE
OWNER_NAME=$OWNER_NAME
EOF
fi
# If app name argument is not provided, then request from user
if [ -z "$APP_NAME" ]; then
read -p $'\e[32m?\e[0m Please input the app name you would like to use: \e[36m' APP_NAME
fi
echo '\033[0m'