Optionally provide full information about matching pairs.
authormdw <mdw>
Wed, 26 Feb 2003 00:02:51 +0000 (00:02 +0000)
committermdw <mdw>
Wed, 26 Feb 2003 00:02:51 +0000 (00:02 +0000)
elite-pairs

index 006583b..d4ce23a 100755 (executable)
@@ -1,6 +1,6 @@
 #! /usr/bin/tclsh
 #
-# $Id: elite-pairs,v 1.2 2003/02/25 00:25:38 mdw Exp $
+# $Id: elite-pairs,v 1.3 2003/02/26 00:02:51 mdw Exp $
 
 package require "elite" "1.0.0"
 
@@ -31,6 +31,7 @@ proc ok {s vv expr} {
 
 set g $galaxy1
 set d 70
+set v 0
 for {set i 0} {$i < [llength $argv]} {incr i} {
   set a [lindex $argv $i]
   switch -glob -- $a {
@@ -48,12 +49,18 @@ for {set i 0} {$i < [llength $argv]} {incr i} {
       incr i
       set d [expr {[lindex $argv $i] * 10}]
     }
+    "-v" {
+      incr v
+    }
+    "-q" {
+      incr v -1
+    }
     "--" {
       incr i
       break
     }
     "-*" {
-      puts stderr "usage: $argv0 \[-g GALAXY\] \[-d DIST\] AEXPR BEXPR"
+      puts stderr "usage: $argv0 \[-qv\] \[-g GALAXY\] \[-d DIST\] AEXPR BEXPR"
       exit 1
     }
     default {
@@ -79,8 +86,14 @@ foreach {s x y} $ww {
   foreach {ss xx yy} $adj($s) {
     set d [world-distance $x $y $xx $yy]
     if {[ok $ss {a d} $bexpr]} {
-      puts [format "%-11s %-11s (%.1f LY)" $a(name) [worldname $ss] \
-         [expr {[world-distance $x $y $xx $yy]/10.0}]]
+      set d [expr {[world-distance $x $y $xx $yy]/10.0}]
+      if {$v} {
+       puts [format "%s (%.1f LY)" [world-summary $s] $d]
+       puts [world-summary $ss]
+       puts ""
+      } else {
+       puts [format "%-11s %-11s (%.1f LY)" $a(name) [worldname $ss] $d]
+      }
     }
   }
 }