57 |
WEBCRLF="false" |
WEBCRLF="false" |
58 |
QUIET="false" |
QUIET="false" |
59 |
|
|
60 |
|
# argvs are global variables - this fixes issues with whitespaces |
61 |
|
# global argvs, the whole command line |
62 |
|
export GLOBAL_ARGV |
63 |
|
# class specific argvs which are given to the class as parameters |
64 |
|
export CLASS_ARGV |
65 |
|
|
66 |
run=run |
run=run |
67 |
valid_session=no |
valid_session=no |
68 |
|
|
72 |
while [[ ${run} = run ]] |
while [[ ${run} = run ]] |
73 |
do |
do |
74 |
read line |
read line |
75 |
|
eval "GLOBAL_ARGV=( ${line} )" |
76 |
|
|
77 |
case ${line} in |
case ${GLOBAL_ARGV[0]} in |
78 |
quit) run=quit ;; |
quit) run=quit ;; |
79 |
|
|
80 |
# only react on the globals -> import|get|set|auth |
# only react on the globals -> import|get|set|auth |
81 |
import*) run_class ${line} ;; |
import) run_class ;; |
82 |
get*) run_class ${line} ;; |
get) run_class ;; |
83 |
set*) run_class ${line} ;; |
set) run_class ;; |
84 |
auth*) validate_auth ${line/auth /} ;; |
auth) validate_auth ${GLOBAL_ARGV[*]:1} ;; |
85 |
provide) valid_session && print_provide ;; |
provide) valid_session && print_provide ;; |
86 |
require) valid_session && verify_requirements ;; |
require) valid_session && verify_requirements ;; |
87 |
reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;; |
reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;; |
93 |
quiet) export QUIET="true" ;; |
quiet) export QUIET="true" ;; |
94 |
# version does not need auth |
# version does not need auth |
95 |
version) print_version ;; |
version) print_version ;; |
96 |
help*) |
help) |
97 |
if valid_session |
if valid_session |
98 |
then |
then |
99 |
if [[ ${line} = help ]] |
if [[ ${line} = help ]] |
114 |
#echo "$line" >> /root/lala.log |
#echo "$line" >> /root/lala.log |
115 |
;; |
;; |
116 |
esac |
esac |
117 |
|
|
118 |
|
# unset argvs to be safe |
119 |
|
unset GLOBAL_ARGS |
120 |
|
unset CLASS_ARGS |
121 |
done |
done |