[Lunar-commits] <lunar-tools> ltime: make it easier to navigate menus by removing directory prefix

Stefan Wold ratler at lunar-linux.org
Sat Sep 13 12:38:21 CEST 2014


commit 1026f648a491504046ba988bcea697477b499559
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Sat, 13 Sep 2014 12:31:53 +0200
URL: https://github.com/lunar-linux/lunar-tools/commit/1026f648a491504046ba988bcea697477b499559

ltime: make it easier to navigate menus by removing directory prefix
---
  prog/ltime | +12/-8    
  1 file changed, 12 insertions(+), 8 deletions(-)

--- a/prog/ltime
+++ b/prog/ltime
@@ -14,11 +14,7 @@
 show_timezones()
 {
     for ITEM in `LANG=C ls --hide=[a-z]* $LOCALTIME/$1`; do
-        if [ -n "$1" ]; then
-            echo "$1/$ITEM"
-        else
-            echo "$ITEM"
-        fi
+        echo "$ITEM"
         if [ -d $LOCALTIME/$1/$ITEM ]; then
             echo "Directory"
         else
@@ -36,17 +32,25 @@ timezone_menu()
     ZONE=""
 
     while
-      TIMEZONES=`show_timezones $ZONE`  &&
-      ZONE=`$DIALOG  --title  "$TITLE"  \
+      TIMEZONES=`show_timezones ${ZDIR:-$ZONE}`  &&
+      if [ -n "$ZDIR" ]; then
+        T="$TITLE - $ZDIR"
+      fi
+      ZONE=`$DIALOG  --title  "${T:-$TITLE}"  \
                      --menu             \
                      "$HELP"            \
                      0 0 0              \
                      $TIMEZONES`        &&
-      [ -d $LOCALTIME/$ZONE ]
+      [[ -d $LOCALTIME/$ZDIR/$ZONE || -d $LOCALTIME/$ZONE ]] &&
+      ZDIR+="$ZONE/"
       do
         true
     done
 
+    if [ -n "$ZDIR" ]; then
+      ZONE="$ZDIR$ZONE"
+    fi
+
     if [ -f "$LOCALTIME/$ZONE" ]; then
         ln -sf $LOCALTIME/$ZONE /etc/localtime
 




More information about the Lunar-commits mailing list