refactor
This commit is contained in:
parent
0dc8e3e6b1
commit
39e1a9b927
15 changed files with 72 additions and 81 deletions
51
live/source/env.sh
Normal file
51
live/source/env.sh
Normal file
|
@ -0,0 +1,51 @@
|
|||
function env {
|
||||
action="${1}"
|
||||
setparams \
|
||||
'time_out'
|
||||
if [ "${action}" == 'load' ] ; then
|
||||
load_env \
|
||||
--skip-sig \
|
||||
--file "${env}" "${@}"
|
||||
fi
|
||||
if [ "${action}" == 'save' ] ; then
|
||||
save_env \
|
||||
--file "${env}" "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
function env_apply {
|
||||
if [ "${default}" ] ; then
|
||||
timeout=${time_out}
|
||||
else
|
||||
unset timeout
|
||||
fi
|
||||
}
|
||||
|
||||
function env_init {
|
||||
env_set
|
||||
env_mod
|
||||
env_apply
|
||||
}
|
||||
|
||||
function env_list {
|
||||
list_env \
|
||||
--skip-sig \
|
||||
--file "${env}"
|
||||
}
|
||||
|
||||
function env_mod {
|
||||
env_mod='?'
|
||||
if [ -f "${env}" ] ; then
|
||||
env_mod='-'
|
||||
if env 'load' ; then
|
||||
env_mod='r'
|
||||
if env 'save' ; then
|
||||
env_mod='w'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function env_set {
|
||||
time_out=10
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue