[49606] trunk/base/src/port1.0/portactivate.tcl

Ryan Schmidt ryandesign at macports.org
Mon Apr 13 01:00:55 PDT 2009


On Apr 13, 2009, at 02:40, perry at macports.org wrote:

> 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.

We already have the wrapline procedure to do this (added in r34354).  
Could this be used here as well, instead of having another separate  
line wrapping implementation?


> 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




More information about the macports-dev mailing list