[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (f1c86ee46c354f47a463e71774b447dc31cd41b8)

Jaka Kranjc scm at sourcemage.org
Fri Nov 23 09:01:14 EST 2007


GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 ChangeLog        |    4 ++++
 usr/sbin/sorcery |   33 +++++++++++++++------------------
 2 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit f1c86ee46c354f47a463e71774b447dc31cd41b8
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    sorcery: rewrote show_installed_spell and fixed remove_pkgs - removing
          spells from the sorcery menu works again

diff --git a/ChangeLog b/ChangeLog
index 5e73bc2..2972c29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-23 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* sorcery: rewrote show_installed_spell and fixed remove_pkgs - removing
+	  spells from the sorcery menu works again
+
 2007-11-21 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* libsummon: fail on any text/ mimetype when checking the tarball source
 	  sanity
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index a5c3a34..8d5bd4f 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -311,25 +311,22 @@ file_menu() {
 
 
 show_installed_spells()  {
+  local spell date status version
 
-  for  LINE  in  `sort  $SPELL_STATUS`;  do
+  while read spell date status version; do
+    if  [[  $status  ==  "installed"  ]]  ||
+        [[  $status  ==  "held"       ]];  then
 
-      SPELL=`echo  "$LINE"    |  cut  -d : -f1`
-     STATUS=`echo  "$LINE"    |  cut  -d : -f3`
-    VERSION=`echo  "$LINE"    |  cut  -d : -f4`
-
-    if  [  "$STATUS"  ==  "installed"  ]  ||
-        [  "$STATUS"  ==  "held"       ];  then
-
-      if  codex_set_current_spell_by_name  $SPELL;  then
-        echo -en   '"'${SPELL:="Unknown"}'"'
-        echo -en '\t"'${VERSION:="-"}'"'
-        echo  -e '\t"'${SHORT:="Description Unavailable"}'"'
+      if  codex_set_current_spell_by_name  $spell;  then
+        SHORT=${SHORT:-"Description unavailable"}
+        echo -en   '"'${spell:="Unknown"}'"'
+        echo -en '\t"'${version:="-"}'"'
+        echo  -e '\t"'${SHORT//\"/\'}'"'
       fi
 
     fi
-  done
-
+  done < <(tr : " " < $SPELL_STATUS) | sort
+  codex_clear_current_spell
 }
 
 
@@ -356,13 +353,13 @@ remove_pkgs() {
     codex_set_current_spell_by_name  $SPELL
     DESCRIPTION=`codex_get_spell_description  $SPELL_DIRECTORY`
 
-    if  $DIALOG  --title      "Remove $SPELL?"  \
+    if  eval $DIALOG  '--title      "Remove $SPELL?"  \
                  --yesno      "$DESCRIPTION"    \
-                 0 0
+                 0 0'
     then
       push_remove_queue  $SPELL                                    &&
-      $DIALOG  --msgbox  "$SPELL added to the remove queue."  0 0  ||
-      $DIALOG  --msgbox  "$SPELL is not really installed?"    0 0
+      eval $DIALOG  '--msgbox  "$SPELL added to the remove queue."  0 0'  ||
+      eval $DIALOG  '--msgbox  "$SPELL is not really installed?"    0 0'
     fi
 
   done



More information about the SM-Commit mailing list