From fef1387580ebcb0014f6d06a45ddcc688c6fb165 Mon Sep 17 00:00:00 2001 From: mdw Date: Wed, 26 Feb 2003 00:02:51 +0000 Subject: [PATCH] Optionally provide full information about matching pairs. --- elite-pairs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/elite-pairs b/elite-pairs index 006583b..d4ce23a 100755 --- a/elite-pairs +++ b/elite-pairs @@ -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] + } } } } -- 2.11.0