26 |
local cmd |
local cmd |
27 |
local argv |
local argv |
28 |
|
|
29 |
if validate_session |
if valid_session |
30 |
then |
then |
31 |
class="${caller%.*}" |
class="${caller%.*}" |
32 |
cmd="${caller#*.}" |
cmd="${caller#*.}" |
58 |
|
|
59 |
topics=$(typeset -f | grep '^help_' | sed 's:help_\(.*\)\ .*():\1:' | sed 's:_:\.:' | sort) |
topics=$(typeset -f | grep '^help_' | sed 's:help_\(.*\)\ .*():\1:' | sed 's:_:\.:' | sort) |
60 |
mecho "Global commands:" |
mecho "Global commands:" |
61 |
mecho "\timport - import settings to database" |
mecho "\timport - import settings to database" |
62 |
mecho "\tget - shows current value for a settings" |
mecho "\tget - shows current value for a settings" |
63 |
mecho "\tset - sets value for a setting" |
mecho "\tset - sets value for a setting" |
64 |
mecho "\tauth - authenticate to the daemon" |
mecho "\tauth - authenticate to the daemon" |
65 |
mecho "\tprovide - shows provides of a system" |
mecho "\tprovide - shows provides of a system" |
66 |
mecho "\thelp - shows help" |
mecho "\trequire - verify plugin requirements" |
67 |
mecho "\tquit - quits the connection to the server" |
mecho "\tnocolors - disable colors, useful for the webclient" |
68 |
|
mecho "\thelp - shows help" |
69 |
|
mecho "\tquit - quits the connection to the server" |
70 |
mecho |
mecho |
71 |
mecho "Help topics:" |
mecho "Help topics:" |
72 |
for i in ${topics} |
for i in ${topics} |
90 |
|
|
91 |
addconfig() |
addconfig() |
92 |
{ |
{ |
93 |
|
local opts |
94 |
|
|
95 |
if [[ -z ${CONFIG} ]] |
if [[ -z ${CONFIG} ]] |
96 |
then |
then |
97 |
echo "You must define \$CONFIG varibale first!" |
echo "You must define \$CONFIG varibale first!" |
102 |
then |
then |
103 |
install -d $(dirname ${CONFIG}) |
install -d $(dirname ${CONFIG}) |
104 |
fi |
fi |
105 |
echo "$@" >> ${CONFIG} |
|
106 |
|
# check for opts |
107 |
|
case $1 in |
108 |
|
-n) shift; opts=" -n" ;; |
109 |
|
-e) shift; opts=" -e" ;; |
110 |
|
esac |
111 |
|
|
112 |
|
echo ${opts} "$@" >> ${CONFIG} |
113 |
} |
} |
114 |
|
|
115 |
clearconfig() |
clearconfig() |
233 |
local COLCYAN="\033[1;36m" |
local COLCYAN="\033[1;36m" |
234 |
local COLDEFAULT="\033[0m" |
local COLDEFAULT="\033[0m" |
235 |
local opts |
local opts |
236 |
|
local webcrlf |
237 |
|
|
238 |
if [[ ${NOCOLORS} = true ]] |
if [[ ${NOCOLORS} = true ]] |
239 |
then |
then |
241 |
COLDEFAULT="" |
COLDEFAULT="" |
242 |
fi |
fi |
243 |
|
|
244 |
|
[[ ${WEBCRLF} = true ]] && webcrlf="<br>" |
245 |
|
|
246 |
# respect -n |
# respect -n |
247 |
case $1 in |
case $1 in |
248 |
-n) shift; opts="n" ;; |
-n) shift; opts="n" ;; |
249 |
esac |
esac |
250 |
|
|
251 |
echo -e${opts} "${COLCYAN}$@${COLDEFAULT}" |
echo -e${opts} "${COLCYAN}$@${COLDEFAULT}${webcrlf}" |
252 |
} |
} |
253 |
|
|
254 |
eecho() |
eecho() |
256 |
local COLRED="\033[1;31m" |
local COLRED="\033[1;31m" |
257 |
local COLDEFAULT="\033[0m" |
local COLDEFAULT="\033[0m" |
258 |
local opts |
local opts |
259 |
|
local webcrlf |
260 |
|
|
261 |
if [[ ${NOCOLORS} = true ]] |
if [[ ${NOCOLORS} = true ]] |
262 |
then |
then |
264 |
COLDEFAULT="" |
COLDEFAULT="" |
265 |
fi |
fi |
266 |
|
|
267 |
|
[[ ${WEBCRLF} = true ]] && webcrlf="<br>" |
268 |
|
|
269 |
# respect -n |
# respect -n |
270 |
case $1 in |
case $1 in |
271 |
-n) shift; opts="n" ;; |
-n) shift; opts="n" ;; |
272 |
esac |
esac |
273 |
|
|
274 |
echo -e${opts} "${COLRED}$@${COLDEFAULT}" |
echo -e${opts} "${COLRED}$@${COLDEFAULT}${webcrlf}" |
275 |
} |
} |
276 |
|
|
277 |
path_not_empty() |
path_not_empty() |