Skip to content

Commit 8fad7a1

Browse files
committed
fix validate and type function behaviour in case
of enumeration, and add clear distinction between list argument and single value
1 parent efea189 commit 8fad7a1

File tree

5 files changed

+180
-248
lines changed

5 files changed

+180
-248
lines changed

argparse.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ proc ::argparse {args} {
718718
} elseif {$argv ne {}} {
719719
# The switch was given the expected argument.
720720
set argv0 [@ [{*}$validateHelper $normal [dict get $def $name] [@ $argv 0]] 0]
721-
set argv0 [@ [{*}$typeChecker $normal [dict get $def $name] [@ $argv 0]] 0]
721+
set argv0 [@ [{*}$typeChecker $normal [dict get $def $name] $argv0] 0]
722722
if {[info exists key]} {
723723
if {[dict exists $def $name optional]} {
724724
dict set result $key [list {} $argv0]
@@ -898,7 +898,7 @@ proc ::argparse {args} {
898898
if {[dict exists $alloc $name]} {
899899
if {![dict exists $opt catchall] && $name ne {}} {
900900
set val [@ [{*}$validateHelper $name $opt [@ $params $i]] 0]
901-
set val [@ [{*}$typeChecker $name $opt [@ $params $i]] 0]
901+
set val [@ [{*}$typeChecker $name $opt $val] 0]
902902
if {[dict exists $opt pass]} {
903903
if {([string index $val 0] eq {-}) && ![dict exists $result [dict get $opt pass]]} {
904904
dict lappend result [dict get $opt pass] --

0 commit comments

Comments
 (0)