Skip to content

Commit a9b52b8

Browse files
author
Alex Silyuk
authored
all done exclude ordering and canceling
1 parent d6ba24d commit a9b52b8

File tree

1 file changed

+60
-51
lines changed

1 file changed

+60
-51
lines changed

client

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ set -e
33
OPT=$(getopt -n "cf-dns" -o "h,v" -l "help,version,register:,movies,order:,history,cancel:,recoverKey:,userkey:,locations,movieID:,movieName:,theaterID:,city:,country:" -- "$@")
44

55
eval set -- "$OPT"
6-
hF=0
7-
vF=0
6+
#flags
87
registerF=0
98
moviesF=0
109
orderF=0
1110
historyF=0
1211
cancelF=0
1312
restoreF=0
14-
username=""
15-
password=""
1613
locationsF=0
1714
movieInfoF=0
15+
#default values
16+
username=""
17+
password=""
1818
userKey=$GLOBAL_USER_KEY
19+
# decoration
1920
format="%3s | %-12s | %-15s | %-50s\n" #format for output
21+
#server address link
22+
server_address="http://localhost"
2023

2124
# check correct format of credentials i.ex : username:password
2225
function check_creds(){
@@ -33,20 +36,69 @@ function check_creds(){
3336
fi
3437
# check not empty credentials
3538
if [ -z "$password" ] || [ -z "$username" ];then
36-
echo "client : Username and pussword can not be empty!"
37-
39+
echo "client : Username and pussword can not be empty!"
3840
exit 1
3941
fi
4042
}
4143

4244

45+
#version
46+
function versionShow(){
47+
echo -e "Linux environment programming: \n\nVersion 1.0\n
48+
Authors:\n-----------------------\nLiran Rotenberg\nJohnatan Leon\nIsabelle Meif\nAlexey Silyuk\n"
49+
exit
50+
}
51+
52+
#Synopsis
53+
function help(){
54+
echo "Movie tickets ordering system :
55+
56+
./client -h : this synopsis
57+
./client -v : version with authors names
58+
59+
Register to system:
60+
./client --register username:password
61+
62+
Recover lost userkey:
63+
./client --recoverKey <USERNAME>:<PASSWORD>
64+
65+
View movies :
66+
All movies:
67+
./client --movies
68+
69+
By ID:
70+
./client --movieID <MOVIEID>
71+
72+
By Name (or part of name,prefix):
73+
./client --movieName \"MOVIE NAME\"
74+
75+
View locations:
76+
All without filtering:
77+
./client --locations
78+
79+
By ID:
80+
./client --locationID <ID>
81+
82+
By Country:
83+
./client --locations --country <COUNTRY>, may be used country prefix
84+
85+
By City:
86+
./client --locations --city <CITY> , may be used city prefix
87+
88+
Ordering :
89+
UNDER CONSTRUCTION
90+
91+
"
92+
exit
93+
}
94+
4395
while [ "$1" != "--" ]; do
4496
case "$1" in
4597
-h|--help)
46-
hF=1
98+
help
4799
;;
48100
-v|--version)
49-
vF=1
101+
versionShow
50102
;;
51103
--register)
52104
register_credentials="$2"
@@ -122,49 +174,6 @@ if ! [ -z "$2" ]; then
122174
exit 1
123175
fi
124176

125-
#version
126-
if [ "$vF" -eq 1 ];then
127-
echo "Linux project version 1.0"
128-
fi
129-
130-
131-
# Synopsis
132-
if [ "$hF" -eq 1 ];then
133-
echo "Movie ordering system :
134-
./client -h : this synopsis
135-
136-
Register to system:
137-
./client --register username:password
138-
139-
Recover lost userkey:
140-
./client --recoverKey <USERNAME>:<PASSWORD>
141-
142-
View movies :
143-
All movies:
144-
./client --movies
145-
146-
By ID:
147-
./client --movieID <MOVIEID>
148-
149-
By Name (or part of name,prefix):
150-
./client --movieName \"MOVIE NAME\"
151-
152-
View locations:
153-
All without filtering:
154-
./client --locations
155-
156-
By ID:
157-
./client --locationID <ID>
158-
159-
By Country:
160-
./client --locations --country <COUNTRY>, may be used country prefix
161-
162-
By City:
163-
./client --locations --city <CITY> , may be used city prefix
164-
165-
"
166-
exit
167-
fi
168177

169178
# Register
170179
if [ "$registerF" == 1 ]; then

0 commit comments

Comments
 (0)