Changeset 37316 for trunk/base/src
- Timestamp:
- 06/02/08 16:37:43 (6 months ago)
- Location:
- trunk/base/src
- Files:
-
- 2 modified
-
macports1.0/macports.tcl (modified) (1 diff)
-
port/port.tcl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/src/macports1.0/macports.tcl
r37046 r37316 659 659 USER GROUP 660 660 http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY 661 COLUMNS LINES 661 662 } 662 663 if {[info exists extra_env]} { -
trunk/base/src/port/port.tcl
r37314 r37316 398 398 399 399 ## 400 # Makes sure we get the current terminal size 401 proc set_term_size {} { 402 global env 403 404 if {![info exists env(COLUMNS)] || ![info exists env(LINES)]} { 405 if {![catch {exec stty size} err]} { 406 regexp {(\d+) (\d+)} $err -> rows cols 407 set env(COLUMNS) $cols 408 set env(LINES) $rows 409 } else { 410 puts stderr "Warning: Unable to get terminal size, using 80x24!" 411 set cols 80 412 set rows 24 413 } 414 } 415 } 416 417 ## 400 418 # Wraps a multi-line string at specified textwidth 401 419 # … … 403 421 # 404 422 # @param string input string 405 # @param maxlen text width ( indent length not counted)423 # @param maxlen text width (0 defaults to current terminal width) 406 424 # @param indent prepend to every line 407 425 # @return wrapped string 408 426 proc wrap {string maxlen {indent ""} {indentfirstline 1}} { 427 global env 428 429 if {$maxlen == 0} { 430 set maxlen $env(COLUMNS) 431 } 432 409 433 set splitstring {} 410 434 foreach line [split $string "\n"] { … … 420 444 # 421 445 # @param line input line 422 # @param maxlen text width ( indent length not counted)446 # @param maxlen text width (0 defaults to current terminal width) 423 447 # @param indent prepend to every line 424 448 # @return wrapped string 425 449 proc wrapline {line maxlen {indent ""} {indentfirstline 1}} { 450 global env 451 452 if {$maxlen == 0} { 453 set maxlen $env(COLUMNS) 454 } 455 426 456 set string [split $line " "] 427 457 if {$indentfirstline == 0} { … … 1184 1214 set ret "Usage: " 1185 1215 set len [string length $action] 1186 append ret [wrap "$action$cmds$args" 80 [string repeat " " [expr 8 + $len]] 0]1216 append ret [wrap "$action$cmds$args" 0 [string repeat " " [expr 8 + $len]] 0] 1187 1217 append ret "\n" 1188 1218 … … 1411 1441 } 1412 1442 puts -nonewline "Variants: " 1413 puts [wrap $vars 80 [string repeat " " 13] 0]1443 puts [wrap $vars 0 [string repeat " " 13] 0] 1414 1444 } 1415 1445 puts "" 1416 1446 if {[info exists portinfo(long_description)]} { 1417 puts [wrap [join $portinfo(long_description)] 80]1447 puts [wrap [join $portinfo(long_description)] 0] 1418 1448 } else { 1419 1449 if {[info exists portinfo(description)]} { 1420 puts [wrap [join $portinfo(description)] 80]1450 puts [wrap [join $portinfo(description)] 0] 1421 1451 } 1422 1452 } … … 2101 2131 } 2102 2132 puts "" 2103 puts [wrap [join $portinfo(description)] 80 [string repeat " " 4]]2133 puts [wrap [join $portinfo(description)] 0 [string repeat " " 4]] 2104 2134 } 2105 2135 } … … 3051 3081 array set private_options {} 3052 3082 3083 # Make sure we get the size of the terminal 3084 # We do this here to save it in the boot_env, in case we determined it manually 3085 set_term_size 3086 3053 3087 # Save off a copy of the environment before mportinit monkeys with it 3054 3088 global env boot_env

