diff --git a/src/modules/punk/args-999999.0a1.0.tm b/src/modules/punk/args-999999.0a1.0.tm index 659af98..35c4693 100644 --- a/src/modules/punk/args-999999.0a1.0.tm +++ b/src/modules/punk/args-999999.0a1.0.tm @@ -583,7 +583,8 @@ tcl::namespace::eval punk::args { } tcl::dict::set arg_info $argname $argspecs tcl::dict::set arg_checks $argname $argchecks - if {![tcl::dict::get $argspecs -optional]} { + #review existence of -default overriding -optional + if {![tcl::dict::get $argspecs -optional] && ![tcl::dict::exists $argspecs -default]} { if {$is_opt} { lappend opt_required $argname } else { @@ -668,7 +669,11 @@ tcl::namespace::eval punk::args { set errmsg $msg if {![catch {package require textblock}]} { append errmsg \n - set t [textblock::class::table new [a+ web-yellow]Usage[a]] + set title "Usage" + if {[dict exists $spec_dict proc_info -name]} { + set title "Usage: [dict get $spec_dict proc_info -name]" + } + set t [textblock::class::table new [a+ web-yellow]$title[a]] $t add_column -headers {Arg} $t add_column -headers {Type} $t add_column -headers {Default} @@ -970,10 +975,10 @@ tcl::namespace::eval punk::args { #} #for now (2024-06) punk::lib::ldiff is a better compromise across normal/safe interps e.g 0.7/0.8us if {[llength [set missing [punk::lib::ldiff $opt_required $flagsreceived]]]} { - arg_error "Required option missing for [Get_caller]. missing flags $missing are marked with -optional false - so must be present in full-length form" $argspecs + arg_error "Required option missing for [Get_caller]. missing flags: '$missing' are marked with -optional false - so must be present in full-length form" $argspecs } if {[llength [set missing [punk::lib::ldiff $val_required $valnames_received]]]} { - arg_error "Required value missing for [Get_caller]. missing values $missing marked with -optional false - so must be present" $argspecs + arg_error "Required value missing for [Get_caller]. missing values: '$missing' marked with -optional false - so must be present" $argspecs } diff --git a/src/modules/punk/cap/handlers/templates-999999.0a1.0.tm b/src/modules/punk/cap/handlers/templates-999999.0a1.0.tm index 9ce510f..39eb5c2 100644 --- a/src/modules/punk/cap/handlers/templates-999999.0a1.0.tm +++ b/src/modules/punk/cap/handlers/templates-999999.0a1.0.tm @@ -646,6 +646,7 @@ namespace eval punk::cap::handlers::templates { #and a name determining command -command_get_item_name method _get_itemdict {args} { set argd [punk::args::get_dict { + *proc -name _get_itemdict *opts -anyopts 0 -startdir -default "" -templatefolder_subdir -optional 0 diff --git a/src/modules/punk/char-999999.0a1.0.tm b/src/modules/punk/char-999999.0a1.0.tm index a87ef47..373b03a 100644 --- a/src/modules/punk/char-999999.0a1.0.tm +++ b/src/modules/punk/char-999999.0a1.0.tm @@ -1993,6 +1993,7 @@ tcl::namespace::eval punk::char { #set text [tcl::string::map [list \u200b "" \u200c "" \u200d "" \uFFEF ""] $text] set text [tcl::string::map [list \u200b "" \u200c "" \u200d ""] $text] #\uFFEF tends to print as 1 length replacement char - REVIEW + #\uFFFF varies between terminals - some print replacement char (width 1) some print nothing (width 0) # -- --- --- --- --- --- --- #we should only map control sequences to nothing after processing ones with length effects, such as \b (\x07f) or DEL \x1f diff --git a/src/modules/punk/mix/commandset/layout-999999.0a1.0.tm b/src/modules/punk/mix/commandset/layout-999999.0a1.0.tm index c11564b..2acbf55 100644 --- a/src/modules/punk/mix/commandset/layout-999999.0a1.0.tm +++ b/src/modules/punk/mix/commandset/layout-999999.0a1.0.tm @@ -31,7 +31,12 @@ namespace eval punk::mix::commandset::layout { #per layout functions - proc files {layout} { + proc files {{layout ""}} { + set argd [punk::args::get_dict { + *values -min 1 -max 1 + layout -type string -minlen 1 + } [list $layout]] + set allfiles [lib::layout_all_files $layout] return [join $allfiles \n] } diff --git a/src/modules/punk/mix/commandset/module-999999.0a1.0.tm b/src/modules/punk/mix/commandset/module-999999.0a1.0.tm index c5387b4..9a5cbcc 100644 --- a/src/modules/punk/mix/commandset/module-999999.0a1.0.tm +++ b/src/modules/punk/mix/commandset/module-999999.0a1.0.tm @@ -132,12 +132,13 @@ namespace eval punk::mix::commandset::module { proc new {args} { set year [clock format [clock seconds] -format %Y] set moduletypes [punk::mix::cli::lib::module_types] + # use \uFFFD because unicode replacement char should consistently render as 1 wide set argspecs [subst { - -project -default \uFFFF - -version -default \uFFFF + -project -default \uFFFD + -version -default \uFFFD -license -default -template -default punk.module - -type -default \uFFFF -choices {$moduletypes} + -type -default \uFFFD -choices {$moduletypes} -force -default 0 -type boolean -quiet -default 0 -type boolean *values -min 1 -max 1 @@ -159,7 +160,7 @@ namespace eval punk::mix::commandset::module { # we need this value before looking at the named argument # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- set opt_version_supplied [dict get $opts -version] - if {$opt_version_supplied eq "\uFFFF"} { + if {$opt_version_supplied eq "\uFFFD"} { set opt_version "0.1.0" } else { set opt_version $opt_version_supplied @@ -185,7 +186,7 @@ namespace eval punk::mix::commandset::module { } else { set vmsg "from -version option: $opt_version_supplied" } - if {$opt_version_supplied ne "\uFFFF"} { + if {$opt_version_supplied ne "\uFFFD"} { if {$vcompare_is_mversion_bigger != 0} { #is bigger or smaller puts stderr "module.new WARNING: version supplied in module argument as well as -version option. Using the higher version number $vmsg" @@ -276,7 +277,7 @@ namespace eval punk::mix::commandset::module { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- set opt_type [dict get $opts -type] - if {$opt_type eq "\uFFFF"} { + if {$opt_type eq "\uFFFD"} { set opt_type [lindex [punk::mix::cli::lib::module_types] 0] ;#default to plain } if {$opt_type ni [punk::mix::cli::lib::module_types]} {