| Ticket UUID: | 916668 | |||
| Title: | getoptions: handling of booleans undocumented | |||
| Type: | Bug | Version: | None | |
| Submitter: | onde | Created on: | 2004-03-15 14:44:17 | |
| Subsystem: | cmdline | Assigned To: | andreas_kupries | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2005-10-11 09:20:24 | |
| Resolution: | Wont Fix | Closed By: | sf-robot | |
| Closed on: | 2005-10-11 02:20:24 | |||
| Description: |
Hi,
from comp.lang.tcl:
Why is it that the handling of boolean vars in
cmdline::getoptions differs from that of other
"datatypes" or rather that this is not mentioned in the
docs?
According to the manpage:
"...optlist contains a list of lists where each element
specifies an option in the form: flag default comment...."
Consider the following example:
package require cmdline
set optlist [list {v 1 "be verbose"} \
{f.arg "index.html" "some usage"}]
if {[catch {array set params [cmdline::getoptions argv
$optlist]} res]} {
puts stderr "$res"
exit
}
# ...process each options
Invoked with -?:
-v 1
^^^
-f value some usage <index.html>
-help Print this message
-? Print this message
The only way to avoid this incorrect usage string is
_not_ to set a default value for booleans.
I think this should be mentioned in the docs, shouldn't it?
Regards,
Andreas
| |||
| User Comments: |
sf-robot added on 2005-10-11 09:20:24:
Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). andreas_kupries added on 2005-09-27 07:01:32: Logged In: YES user_id=75003 This is likely not a bug in the docs, but a bug in the generation of the usage string. Ok, having looked at the output as I have it (CVS Head) I see a clear demarkation between the -v and the character '1'. Basically the output has two columns. In the first we see the option, like "-v", or "-foo value", with the string "value" as indicator that the option takes an argument. The second column then shows the default value, if there is one. I have no problem seeing that -v is a boolean option not taking an argument (missing string "value"), and true by default. Whereas -foo is an option taking an argument, indicated by "value". | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki