Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4322842d40
Fetching contributors…

Cannot retrieve contributors at this time

file 85 lines (77 sloc) 2.228 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
############################################################
# #
# This code is written for Lunar Linux, see #
# http://lunar-linux.org #
# #
############################################################
# #
# Copyright 2007 (c) GPLv2 - Auke Kok #
# #
############################################################


alias_menu_list_aliases()
{
for A in `cut -d: -f1 $MOONBASE/aliases`; do
echo ${A:1}
CHOICE=$(get_local_config `echo LUNAR_ALIAS_${A:1}`)
if [ -n "$CHOICE" ] ; then
echo "$CHOICE"
else
echo "[unset]"
fi
done
}


alias_menu_list_alias_choices()
{
echo "None"
echo "None"
if [ -z "$(get_local_config `echo LUNAR_ALIAS_$1`)" ] ; then
echo "on"
else
echo "off"
fi
IFS=$STANDARD_IFS
for C in `grep "^%$1:" $MOONBASE/aliases | cut -d: -f2`; do
echo "$C"
echo "$C"
if [ $(get_local_config `echo LUNAR_ALIAS_$1`) == "$C" ] ; then
echo "on"
else
echo "off"
fi
done
}


select_aliases()
{
export IFS=$ENTER_IFS

while true ; do
DEFAULT=${CHOICE}
CHOICE=`$DIALOG --title "Select Lunar Aliases" \
--ok-label "Select" \
--cancel-label "Close" \
--default-item "$DEFAULT" \
--menu "" 0 0 0 \
$(alias_menu_list_aliases)`
if [ $? != 0 ]; then
return
fi

# modify an alias
DEFAULT=$(get_local_config `echo LUNAR_ALIAS_$CHOICE`)
if [ -z "$DEFAULT" ] ; then
DEFAULT="None"
fi
ACHOICE=`$DIALOG --title "Select Lunar Aliases" \
--ok-label "Select" \
--cancel-label "Close" \
--default-item "$DEFAULT" \
--radiolist "" 0 0 0 \
$(alias_menu_list_alias_choices $CHOICE)`
if [ $? == 0 ]; then
# modify it
if [ "$ACHOICE" != "None" ] ; then
set_local_config `echo LUNAR_ALIAS_$CHOICE` "$ACHOICE"
else
unset_local_config `echo LUNAR_ALIAS_$CHOICE`
fi
fi
done
}
Something went wrong with that request. Please try again.