From de8c5ff7ada898dd556c8bb99396ecba6972b61f Mon Sep 17 00:00:00 2001
From: Julian Noble ??
- set leader_min 0
- set leader_max 0 ;#default 0 but if leader_min is set switches to -1 for no limit
+ set doc_info {}
+ set parser_info {}
+ set leader_min ""
+ #set leader_min 0
+ #set leader_max 0 ;#default 0 but if leader_min is set switches to -1 for no limit
+ set leader_max ""
#(common case of no leaders specified)
set opt_any 0
set val_min 0
set val_max -1 ;#-1 for no limit
set spec_id ""
set argspace "leaders" ;#leaders -> options -> values
+ set parser_id 0
foreach ln $records {
set trimln [tcl::string::trim $ln]
switch -- [tcl::string::index $trimln 0] {
@@ -510,10 +566,45 @@ tcl::namespace::eval punk::args {
error "punk::args::definition - bad *id line. Remaining items on line after *id
\$script\] \{"
+ set i 0
+ set tails [lrepeat [llength $parts] ""]
+ foreach ns $parts {
+ set cmdlist [list ::punk::ns::eval_no_create $ns]
+ set t ""
+ if {$i > 0} {
+ append body " "
+ }
+ append body $cmdlist
+ if {$i == ([llength $parts] -1)} {
+ append body " {
}"
+ }
+ if {$i > 0} {
+ set t {
Return a string with ansi codes stripped out
Alternate graphics chars are replaced with modern unicode equivalents (e.g boxdrawing glyphs)
Return a string with ansi codes stripped out
Alternate graphics chars are replaced with modern unicode equivalents (e.g boxdrawing glyphs)
The lines beginning with * are optional in most cases and can be used to set defaults and some extra controls
- the above example would work just fine with only the -<optionname> lines, but would allow zero filenames to be supplied as no -min value is set for *values
-valid * lines being with *proc *opts *values
+valid * lines being with *proc *leaders *opts *values
lines beginning with a dash define options - a name can optionally be given to each trailing positional argument.
If no names are defined for positional arguments, they will end up in the values key of the dict with numerical keys starting at zero.
e.g the result from the punk::args call above may be something like:
@@ -199,7 +199,7 @@ *values -min 2 -max 2 fileA -type existingfile 1 fileB -type existingfile 1 - } $args]] opts values + } $args]] leaders opts values puts "$category fileA: [dict get $values fileA]" puts "$category fileB: [dict get $values fileB]" } @@ -291,15 +291,17 @@ For functions that are part of an API a package may be more suitable.class definitions
-cooperative namespace punk::args::register
+punk::args aware packages may add their own namespace to the public list variable NAMESPACES before or after punk::args is loaded
+The punk::args package will then test for a public list variable <namepace>::PUNKARGS containing argument definitions when it needs to.
+Core API functions for punk::args
Parse rawargs as a sequence of zero or more option-value pairs followed by zero or more values
Returns a dict of the form: opts <options_dict> values <values_dict>
ARGUMENTS:
@@ -314,7 +316,7 @@ For functions that are part of an API a package may be more suitable.argumentname -key val -ky2 val2...
where the valid keys for each option specification are: -default -type -range -choices
comment lines begining with # are ignored and can be placed anywhere except within a multiline value where it would become part of that value
-lines beginning with *proc *opts or *values also take -key val pairs and can be used to set defaults and control settings.
+lines beginning with *proc *leaders *opts or *values also take -key val pairs and can be used to set defaults and control settings.
*opts or *values lines can appear multiple times with defaults affecting flags/values that follow.
This is a list of the arguments to parse. Usually it will be the $args value from the containing proc, diff --git a/src/embedded/www/doc/files/punk/_module_console-0.1.1.tm.html b/src/embedded/www/doc/files/punk/_module_console-0.1.1.tm.html index a8c257d6..fefbe9cc 100644 --- a/src/embedded/www/doc/files/punk/_module_console-0.1.1.tm.html +++ b/src/embedded/www/doc/files/punk/_module_console-0.1.1.tm.html @@ -150,7 +150,9 @@
packages used by punk::console
Tcl 8.6-
Thread
punk::ansi
punk::args
packages used by punk::lib
Tcl 8.6-
punk::args
punkshell_module_punk::safe - Module API
+-
+class definitions +if { eq ""} {
+} +} + ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
+Internal functions that are not part of the API
+Copyright © 2024
+punkshell_module_punk::sixel - punk::sixel API
+Experimental support functions for working with sixel data
+For real sixel work a version written in a systems language such as c or zig may be required.
+class definitions +if { eq ""} {
+} +} + ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
+Copyright © 2024
+punkshell_module_punk::args::tclcore - punk::args definitions for tcl core commands
+-
+class definitions +if { eq ""} {
+} +} + ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
+tcl::namespace::eval punk::args::tclcore::system {
+Internal functions that are not part of the API
+Copyright © 2025
+punkshell_module_punk::repl::codethread - Module repl codethread
+This is part of the infrastructure required for the punk::repl to operate
+Internal functions that are not part of the API
+Copyright © 2024
+