[49606] trunk/base/src/port1.0/portactivate.tcl
perry at macports.org
perry at macports.org
Mon Apr 13 00:40:23 PDT 2009
Revision: 49606
http://trac.macports.org/changeset/49606
Author: perry at macports.org
Date: 2009-04-13 00:40:18 -0700 (Mon, 13 Apr 2009)
Log Message:
-----------
port1.0/portactivate.tcl - Wrap notes output to the terminal's width.
Modified Paths:
--------------
trunk/base/src/port1.0/portactivate.tcl
Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl 2009-04-13 05:55:44 UTC (rev 49605)
+++ trunk/base/src/port1.0/portactivate.tcl 2009-04-13 07:40:18 UTC (rev 49606)
@@ -52,12 +52,39 @@
set_ui_prefix
proc portactivate::activate_main {args} {
- global portname portversion portrevision portvariants user_options portnotes
+ global env portname portversion portrevision portvariants user_options portnotes
registry_activate $portname ${portversion}_${portrevision}${portvariants} [array get user_options]
# Display notes at the end of the activation phase.
if {[info exists portnotes] && $portnotes ne {}} {
- ui_msg \n$portnotes\n
+ # If env(COLUMNS) exists, limit each line's width to this width.
+ if {[info exists env(COLUMNS)]} {
+ set maxlen $env(COLUMNS)
+
+ ui_msg ""
+ foreach line [split $portnotes "\n"] {
+ set joiner ""
+ set lines ""
+ set newline ""
+
+ foreach word [split $line " "] {
+ if {[string length $newline] + [string length $word] >= $maxlen} {
+ lappend lines $newline
+ set newline ""
+ set joiner ""
+ }
+ append newline $joiner $word
+ set joiner " "
+ }
+ if {$newline ne {}} {
+ lappend lines $newline
+ }
+ ui_msg [join $lines "\n"]
+ }
+ ui_msg ""
+ } else {
+ ui_msg \n$portnotes\n
+ }
}
return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090413/4e887b01/attachment.html>
More information about the macports-changes
mailing list