Add patterns for printing attributes in elite-cmdr.
authormdw <mdw>
Sun, 9 Mar 2003 17:59:48 +0000 (17:59 +0000)
committermdw <mdw>
Sun, 9 Mar 2003 17:59:48 +0000 (17:59 +0000)
README
elite-cmdr

diff --git a/README b/README
index 62aba1d..ad122ab 100644 (file)
--- a/README
+++ b/README
@@ -283,7 +283,10 @@ RIGHT ON COMMAND-LINE
 
        An attribute name on its own is a request to print the current
        value of that attribute.  An assignment ATTR=VALUE makes ATTR
-       have the requested VALUE.
+       have the requested VALUE.  When requesting attributes, you can
+       instead give a pattern containing `*' and `?' metacharacters
+       (matching zero or more, or exactly one character) -- all
+       matching attributes are printed.
 
        The attributes, their meanings, and the acceptable values are as
        follows:
@@ -555,7 +558,7 @@ RIGHT ON COMMAND-LINE
        unrewarding) or pirates (risky and tedious), and start trading
        food and other cheap items.
 
-$Id: README,v 1.7 2003/03/07 00:47:13 mdw Exp $
+$Id: README,v 1.8 2003/03/09 17:59:48 mdw Exp $
 \f
 Local variables:
 mode: text
index e534158..d75feda 100755 (executable)
@@ -238,19 +238,23 @@ for {set i 0} {$i < [llength $argv]} {incr i} {
        exit 1
       }
     }
-    "^[a-z][a-z-]*$" {
-      if {![info exists attr($a)]} {
-       puts stderr "$argv0: no such attribute `$a'"
-       exit 1
-      }
-      puts [format "%-20s %s" $a [eval \
-         get/[lindex $attr($a) 0] [lrange $attr($a) 1 end] [list $a]]]
-      set acted 1
-    }
     default {
-      if {[catch { elite-unpackcmdr cmdr [read-file $a] } err]} {
-       puts stderr "$argv0: couldn't read `$a': $err"
-       exit 1
+      set n 0
+      foreach aa $attrs {
+       if {[string match $a $aa]} {
+         incr n
+         puts [format "%-20s %s" $aa [eval \
+             get/[lindex $attr($aa) 0] \
+             [lrange $attr($aa) 1 end] [list $aa]]]
+       }
+      }
+      if {$n} {
+       set acted 1
+      } else {
+       if {[catch { elite-unpackcmdr cmdr [read-file $a] } err]} {
+         puts stderr "$argv0: couldn't read `$a': $err"
+         exit 1
+       }
       }
     }
   }