Skip to content
Permalink
Browse files

- Make a cmdname global to carry the shortened argv0

 - Use this instead of repeatedly coming to the same conclusion
 - Add our cmdname to --version message to make it a bit more clear,
   in a nod to Joe Auty, but without going into toooo much detail.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@14588 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
jdberry committed Oct 13, 2005
1 parent 07ceb1d commit 91f08e8abef239e8c059a17b7a3a62db8a16c629
Showing with 10 additions and 8 deletions.
  1. +10 −8 src/port/port.tcl
@@ -2,7 +2,7 @@
#\
exec @TCLSH@ "$0" "$@"
# port.tcl
# $Id: port.tcl,v 1.133 2005/10/12 22:36:18 jberry Exp $
# $Id: port.tcl,v 1.134 2005/10/13 00:59:16 jberry Exp $
#
# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
# Copyright (c) 2002 Apple Computer, Inc.
@@ -53,6 +53,9 @@ array set global_variations {}
global env
array set boot_env [array get env]

global argv0
set cmdname [file tail $argv0]

# UI Instantiations
# ui_options(ports_debug) - If set, output debugging messages.
# ui_options(ports_verbose) - If set, output info messages (ui_info)
@@ -134,19 +137,18 @@ proc ui_channels {priority} {

# Standard procedures
proc print_usage args {
global argv0
set cmd [file tail $argv0]
global cmdname
set usage { [-vdqfonasbckt] [-D portdir] [-u porturl] action [actionflags]
[[portname|pseudo-portname|port-url] [version] [+-variant]... [option=value]...]...
}

puts "Usage: $cmd $usage"
puts "\"$cmd help\" or \"man 1 port\" for more information."
puts "Usage: $cmdname$usage"
puts "\"$cmdname help\" or \"man 1 port\" for more information."
}


proc print_help args {
global argv0
global cmdname

set help { [-vdqfonasbckt] [-D portdir] [-u porturl] action [actionflags]
[[portname|pseudo-portname|port-url] [version] [+-variant]... [option=value]...]...
@@ -185,7 +187,7 @@ For more information:

}

puts "[file tail $argv0]$help"
puts "$cmdname$help"
}


@@ -1074,7 +1076,7 @@ while {[moreargs]} {
} elseif {[string index $arg 1] == "-"} {
# Process long arguments
switch -- $arg {
--version { ui_warn {(please use "version" to get version information)}; set action "version" }
--version { ui_warn "(please use \"$cmdname version\" to get version information)"; set action "version" }
default { print_usage; exit 1 }
}
} else {

0 comments on commit 91f08e8

Please sign in to comment.
You can’t perform that action at this time.