[Lunar-commits] r22485 - lunar/trunk/var/lib/lunar/functions

Auke Kok sofar at lunar-linux.org
Wed Dec 6 17:56:20 CET 2006


Author: sofar
Date: 2006-12-06 17:56:19 +0100 (Wed, 06 Dec 2006)
New Revision: 22485

Modified:
   lunar/trunk/var/lib/lunar/functions/aliases.lunar
Log:
Allow the user to press [ENTER] when provided with aliases, which will automatically pick alias #1, and we'll order the moonbase/aliases such that those provide the recommended order.


Modified: lunar/trunk/var/lib/lunar/functions/aliases.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/aliases.lunar	2006-12-06 16:48:54 UTC (rev 22484)
+++ lunar/trunk/var/lib/lunar/functions/aliases.lunar	2006-12-06 16:56:19 UTC (rev 22485)
@@ -48,7 +48,8 @@
   debug_msg "unalias: starting selection loop"
   error_message "${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} depends on ${DEFAULT_COLOR}${QUERY_COLOR}\"${1:1}\"${DEFAULT_COLOR}${MESSAGE_COLOR} which is an alias${DEFAULT_COLOR}"
   while true ; do
-    error_message "${MESSAGE_COLOR}Please select a substitute ! Enter the number or the name of the module${DEFAULT_COLOR}"
+    error_message "${MESSAGE_COLOR}Please select a substitute ! Enter the number or the name of the module"
+    error_message "Press [ENTER] to select choice #1 (the recommended choice).${DEFAULT_COLOR}"
     ((N=0))
     for TARGET in $TARGETS ; do
       ((N++))
@@ -62,8 +63,8 @@
       set_local_config `echo LUNAR_ALIAS_${1:1}` $TARGET
       echo $TARGET
       return
-    # then the number
-    elif [[ -n "$CHOICE" ]] && [[ -n "${TARGETBYNUM[$CHOICE]}" ]] ; then
+    # then the number, resolving the default
+    elif [[ -n "${TARGETBYNUM[${CHOICE:=1}]}" ]] ; then
       verbose_msg "Stored alias mapping $1 -> ${TARGETBYNUM[$CHOICE]}"
       set_local_config `echo LUNAR_ALIAS_${1:1}` ${TARGETBYNUM[$CHOICE]}
       echo ${TARGETBYNUM[$CHOICE]}



More information about the Lunar-commits mailing list