refactor
This commit is contained in:
parent
0dc8e3e6b1
commit
39e1a9b927
15 changed files with 72 additions and 81 deletions
53
live/source/menu.sh
Normal file
53
live/source/menu.sh
Normal file
|
@ -0,0 +1,53 @@
|
|||
function menu {
|
||||
if [ "${1}" ] ; then
|
||||
menu_load "${1}"
|
||||
else
|
||||
export "${menu}"
|
||||
menu_load "${menu}"
|
||||
fi
|
||||
}
|
||||
|
||||
function menu_color {
|
||||
menu_item \
|
||||
'black' 'blue' 'green' 'cyan' \
|
||||
'red' 'magenta' 'brown' 'light-gray' \
|
||||
'dark-gray' 'light-blue' 'light-green' 'light-cyan' \
|
||||
'light-red' 'light-magenta' 'yellow' 'white'
|
||||
}
|
||||
|
||||
function menu_init {
|
||||
if [ "${1}" ] ; then
|
||||
menuentry "→ ${menu} → ${1}" { nop }
|
||||
else
|
||||
menuentry "→ ${menu}" { nop }
|
||||
fi
|
||||
menu_split
|
||||
default=2
|
||||
}
|
||||
|
||||
function menu_item {
|
||||
eval "default=\"id_\${${menu}}\""
|
||||
for item in "${@}" ; do
|
||||
menuentry "${item}" "${menu}" --id "id_${item}" {
|
||||
eval "${2}=\"${1}\""
|
||||
menu
|
||||
}
|
||||
done
|
||||
unset item
|
||||
}
|
||||
|
||||
function menu_load {
|
||||
menu="${1}"
|
||||
export menu
|
||||
# env_export
|
||||
var_export
|
||||
configfile "${live}/menu/${menu}.sh"
|
||||
}
|
||||
|
||||
function menu_split {
|
||||
if [ "${1}" ] ; then
|
||||
menuentry '' --id "${1}" { nop }
|
||||
else
|
||||
menuentry '' { nop }
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue