49 lines
998 B
Bash
49 lines
998 B
Bash
|
function menu {
|
||
|
if [ "${1}" ] ; then
|
||
|
menu_load "${1}" "${menus}/${1}.sh"
|
||
|
else
|
||
|
menu_load 'main' "${menus}/main.sh"
|
||
|
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 nav
|
||
|
# env_export
|
||
|
var_export
|
||
|
configfile "${2}"
|
||
|
}
|
||
|
|
||
|
function menu_split {
|
||
|
menuentry '' { nop }
|
||
|
}
|