#wrap to terminal width, so line lengths here directly set the table width
set basehelp {Help system for the punk shell.
With no arguments - an overview of some key shell commands is displayed.
When the first argument is a recognised topic - help for that topic is displayed.
With no arguments - an overview of some key shell
commands is displayed.
When the first argument is a recognised topic - help
for that topic is displayed.
('help topics' lists the available topics)
Anything else is treated as a command name - basic command info (type and
synopsis) is shown for a resolvable command, or the resolved path for an
Anything else is treated as a command name - basic
command info (type and synopsis) is shown for a
resolvable command, or the resolved path for an
external executable.}
set topichelp {Help topic, or command words for basic command info. (topics must match exactly - no prefix matching)}
set topichelp "Help topic, or command words for basic command info.\nTopics accept their aliases and unique prefixes\n(some short words deliberately fall through to command lookup)."
set specs [list]
lappend specs ::punk::help help "Punk shell help system." ""
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of{channel text} chunks rather than emitting it."
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of\n{channel text} chunks rather than emitting it."
#quiet undefine - redefinition on registry change is expected, not noteworthy
@ -8548,7 +8569,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::topics
@cmd -name "help topics" -summary "List help topics." -help "Show the table of topics known to the help system, including registered aliases for each topic."
@cmd -name "help topics"\
-summary\
"List help topics."\
-help\
"Show the table of topics known to the help system,
including registered aliases for each topic."
@values -min 0 -max 0
}
proc topics {context args} {
@ -8570,7 +8596,15 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::tcl
@cmd -name "help tcl" -summary "Tcl version warnings." -help "Show the running Tcl patchlevel and build-info, with warnings for known Tcl bugs affecting this interpreter and known bugs in bundled library packages (as detected by the punk::lib::check::has_tclbug_* and has_libbug_* checks)."
@cmd -name "help tcl"\
-summary\
"Tcl version warnings."\
-help\
"Show the running Tcl patchlevel and build-info, with
warnings for known Tcl bugs affecting this interpreter
and known bugs in bundled library packages
(as detected by the punk::lib::check::has_tclbug_*
and has_libbug_* checks)."
@values -min 0 -max 0
}
proc tcl {context args} {
@ -8629,7 +8663,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::env
@cmd -name "help env" -summary "punkshell environment vars." -help "Show punk-related and other relevant environment variables with their current values."
@cmd -name "help env"\
-summary\
"punkshell environment vars."\
-help\
"Show punk-related and other relevant environment
variables with their current values."
@values -min 0 -max 0
}
proc env {context args} {
@ -8730,7 +8769,14 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::console
@cmd -name "help console" -summary "Console behaviour tests and warnings." -help "Run some console/terminal behaviour tests (control string hiding, grapheme cluster support, cursor position query timing) and report warnings. Requires a responsive interactive console."
@cmd -name "help console"\
-summary\
"Console behaviour tests and warnings."\
-help\
"Run some console/terminal behaviour tests (control
set bytecode_safe [x eval {tcl::unsupported::disassemble proc ::ensembletest}]
if {[catch {x eval {tcl::unsupported::disassemble proc ::ensembletest}} bytecode_safe]} {
#Tcl 9.1+ removes tcl::unsupported::* from safe interps - disassemble is instead a hidden command (tcl:unsupported:disassemble)
set bytecode_safe [interp invokehidden x tcl:unsupported:disassemble proc ::ensembletest]
}
if {$show} {
puts safe:
puts $bytecode_safe
@ -1311,14 +1314,27 @@ namespace eval punk::lib {
#tcl 8.7+ lseq significantly faster, especially for larger ranges
#The internal rep can be an 'arithseries' with no string representation
#support minimal set from to
proc range {from to {by 1}} {
proc range {from to {by ""}} {
#note inconsistency with lseq 1 10 by -9 vs lseq 1 10 by -10
#https://core.tcl-lang.org/tcl/tktview/999b6966b2
#lseq in Tcl 9.1+ no longer evaluates expression operands such as 4-1 (TIP 746)
#range continues to accept int[+-]int offset forms e.g `range 0 [llength $list]-1` (same contract as the non-lseq fallback below)
if {![string is double -strict $from]} {set from [offset_expr $from]}
if {![string is double -strict $to]} {set to [offset_expr $to]}
if {$by eq ""} {
#direction inferred - lseq produces a descending sequence when from > to (matching the non-lseq fallback below)
return [lseq $from $to]
}
if {![string is double -strict $by]} {set by [offset_expr $by]}
if {$by == 0} {
#documented range behaviour (and lseq behaviour prior to Tcl 9.1): a step of zero produces no results
return [list]
}
lseq $from $to by $by
}
} else {
#lseq accepts basic expressions e.g 4-2 for both arguments
#e.g we can do lseq 0 [llength $list]-1
#lseq prior to Tcl 9.1 (TIP 746) accepted basic expressions e.g 4-2 for both arguments
#range accepts int[+-]int offset forms in all branches e.g we can do range 0 [llength $list]-1
#if range is to be consistent with the lseq version above - it should support that, even though we don't support most lseq functionality in either wrapper.
#our range function doesn't support double like lseq does. (deliberate) review
#wrap to terminal width, so line lengths here directly set the table width
set basehelp {Help system for the punk shell.
With no arguments - an overview of some key shell commands is displayed.
When the first argument is a recognised topic - help for that topic is displayed.
With no arguments - an overview of some key shell
commands is displayed.
When the first argument is a recognised topic - help
for that topic is displayed.
('help topics' lists the available topics)
Anything else is treated as a command name - basic command info (type and
synopsis) is shown for a resolvable command, or the resolved path for an
Anything else is treated as a command name - basic
command info (type and synopsis) is shown for a
resolvable command, or the resolved path for an
external executable.}
set topichelp {Help topic, or command words for basic command info. (topics must match exactly - no prefix matching)}
set topichelp "Help topic, or command words for basic command info.\nTopics accept their aliases and unique prefixes\n(some short words deliberately fall through to command lookup)."
set specs [list]
lappend specs ::punk::help help "Punk shell help system." ""
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of{channel text} chunks rather than emitting it."
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of\n{channel text} chunks rather than emitting it."
#quiet undefine - redefinition on registry change is expected, not noteworthy
@ -8548,7 +8569,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::topics
@cmd -name "help topics" -summary "List help topics." -help "Show the table of topics known to the help system, including registered aliases for each topic."
@cmd -name "help topics"\
-summary\
"List help topics."\
-help\
"Show the table of topics known to the help system,
including registered aliases for each topic."
@values -min 0 -max 0
}
proc topics {context args} {
@ -8570,7 +8596,15 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::tcl
@cmd -name "help tcl" -summary "Tcl version warnings." -help "Show the running Tcl patchlevel and build-info, with warnings for known Tcl bugs affecting this interpreter and known bugs in bundled library packages (as detected by the punk::lib::check::has_tclbug_* and has_libbug_* checks)."
@cmd -name "help tcl"\
-summary\
"Tcl version warnings."\
-help\
"Show the running Tcl patchlevel and build-info, with
warnings for known Tcl bugs affecting this interpreter
and known bugs in bundled library packages
(as detected by the punk::lib::check::has_tclbug_*
and has_libbug_* checks)."
@values -min 0 -max 0
}
proc tcl {context args} {
@ -8629,7 +8663,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::env
@cmd -name "help env" -summary "punkshell environment vars." -help "Show punk-related and other relevant environment variables with their current values."
@cmd -name "help env"\
-summary\
"punkshell environment vars."\
-help\
"Show punk-related and other relevant environment
variables with their current values."
@values -min 0 -max 0
}
proc env {context args} {
@ -8730,7 +8769,14 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::console
@cmd -name "help console" -summary "Console behaviour tests and warnings." -help "Run some console/terminal behaviour tests (control string hiding, grapheme cluster support, cursor position query timing) and report warnings. Requires a responsive interactive console."
@cmd -name "help console"\
-summary\
"Console behaviour tests and warnings."\
-help\
"Run some console/terminal behaviour tests (control
#Aliases are accepted at parse (exact, and as prefix-calculation members when
#-choiceprefix applies) and normalize to their canonical choice in the parse
#result; usage display folds them into the canonical entry.
#Cross-validation against the final choice set happens after all specs merge.
if {![punk::args::lib::string_is_dict $specval]} {
error "punk::args::resolve - invalid value for key '$spec' in specifications for argument '$argname' - value must be a dictionary of alias -> canonical-choice @id:$DEF_definition_id"
error "punk::args::resolve - -choicealiases for argument '$argname' maps alias '$ca_alias' to '$ca_canonical' which is not in -choices/-choicegroups @id:$DEF_definition_id"
}
if {$ca_alias in $ca_allchoices} {
error "punk::args::resolve - -choicealiases for argument '$argname' alias '$ca_alias' collides with a defined choice @id:$DEF_definition_id"
#generally we expect values to contain leading dashes only if -- specified. Otherwise no reliable way determine difference between bad flags and values
#If no eopts (--) specified we stop looking for opts at the first nondash encountered in a position we'd expect a dash - so without eopt, values could contain dashes - but not in first position after flags.
set bytecode_safe [x eval {tcl::unsupported::disassemble proc ::ensembletest}]
if {[catch {x eval {tcl::unsupported::disassemble proc ::ensembletest}} bytecode_safe]} {
#Tcl 9.1+ removes tcl::unsupported::* from safe interps - disassemble is instead a hidden command (tcl:unsupported:disassemble)
set bytecode_safe [interp invokehidden x tcl:unsupported:disassemble proc ::ensembletest]
}
if {$show} {
puts safe:
puts $bytecode_safe
@ -1311,14 +1314,27 @@ namespace eval punk::lib {
#tcl 8.7+ lseq significantly faster, especially for larger ranges
#The internal rep can be an 'arithseries' with no string representation
#support minimal set from to
proc range {from to {by 1}} {
proc range {from to {by ""}} {
#note inconsistency with lseq 1 10 by -9 vs lseq 1 10 by -10
#https://core.tcl-lang.org/tcl/tktview/999b6966b2
#lseq in Tcl 9.1+ no longer evaluates expression operands such as 4-1 (TIP 746)
#range continues to accept int[+-]int offset forms e.g `range 0 [llength $list]-1` (same contract as the non-lseq fallback below)
if {![string is double -strict $from]} {set from [offset_expr $from]}
if {![string is double -strict $to]} {set to [offset_expr $to]}
if {$by eq ""} {
#direction inferred - lseq produces a descending sequence when from > to (matching the non-lseq fallback below)
return [lseq $from $to]
}
if {![string is double -strict $by]} {set by [offset_expr $by]}
if {$by == 0} {
#documented range behaviour (and lseq behaviour prior to Tcl 9.1): a step of zero produces no results
return [list]
}
lseq $from $to by $by
}
} else {
#lseq accepts basic expressions e.g 4-2 for both arguments
#e.g we can do lseq 0 [llength $list]-1
#lseq prior to Tcl 9.1 (TIP 746) accepted basic expressions e.g 4-2 for both arguments
#range accepts int[+-]int offset forms in all branches e.g we can do range 0 [llength $list]-1
#if range is to be consistent with the lseq version above - it should support that, even though we don't support most lseq functionality in either wrapper.
#our range function doesn't support double like lseq does. (deliberate) review
#wrap to terminal width, so line lengths here directly set the table width
set basehelp {Help system for the punk shell.
With no arguments - an overview of some key shell commands is displayed.
When the first argument is a recognised topic - help for that topic is displayed.
With no arguments - an overview of some key shell
commands is displayed.
When the first argument is a recognised topic - help
for that topic is displayed.
('help topics' lists the available topics)
Anything else is treated as a command name - basic command info (type and
synopsis) is shown for a resolvable command, or the resolved path for an
Anything else is treated as a command name - basic
command info (type and synopsis) is shown for a
resolvable command, or the resolved path for an
external executable.}
set topichelp {Help topic, or command words for basic command info. (topics must match exactly - no prefix matching)}
set topichelp "Help topic, or command words for basic command info.\nTopics accept their aliases and unique prefixes\n(some short words deliberately fall through to command lookup)."
set specs [list]
lappend specs ::punk::help help "Punk shell help system." ""
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of{channel text} chunks rather than emitting it."
lappend specs ::punk::help_chunks punk::help_chunks "Punk shell help system - content as {channel text} chunks." "\n\nhelp_chunks returns the help content as a list of\n{channel text} chunks rather than emitting it."
#quiet undefine - redefinition on registry change is expected, not noteworthy
@ -8548,7 +8569,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::topics
@cmd -name "help topics" -summary "List help topics." -help "Show the table of topics known to the help system, including registered aliases for each topic."
@cmd -name "help topics"\
-summary\
"List help topics."\
-help\
"Show the table of topics known to the help system,
including registered aliases for each topic."
@values -min 0 -max 0
}
proc topics {context args} {
@ -8570,7 +8596,15 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::tcl
@cmd -name "help tcl" -summary "Tcl version warnings." -help "Show the running Tcl patchlevel and build-info, with warnings for known Tcl bugs affecting this interpreter and known bugs in bundled library packages (as detected by the punk::lib::check::has_tclbug_* and has_libbug_* checks)."
@cmd -name "help tcl"\
-summary\
"Tcl version warnings."\
-help\
"Show the running Tcl patchlevel and build-info, with
warnings for known Tcl bugs affecting this interpreter
and known bugs in bundled library packages
(as detected by the punk::lib::check::has_tclbug_*
and has_libbug_* checks)."
@values -min 0 -max 0
}
proc tcl {context args} {
@ -8629,7 +8663,12 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::env
@cmd -name "help env" -summary "punkshell environment vars." -help "Show punk-related and other relevant environment variables with their current values."
@cmd -name "help env"\
-summary\
"punkshell environment vars."\
-help\
"Show punk-related and other relevant environment
variables with their current values."
@values -min 0 -max 0
}
proc env {context args} {
@ -8730,7 +8769,14 @@ namespace eval punk {
punk::args::define {
@id -id ::punk::helptopic::console
@cmd -name "help console" -summary "Console behaviour tests and warnings." -help "Run some console/terminal behaviour tests (control string hiding, grapheme cluster support, cursor position query timing) and report warnings. Requires a responsive interactive console."
@cmd -name "help console"\
-summary\
"Console behaviour tests and warnings."\
-help\
"Run some console/terminal behaviour tests (control
#Aliases are accepted at parse (exact, and as prefix-calculation members when
#-choiceprefix applies) and normalize to their canonical choice in the parse
#result; usage display folds them into the canonical entry.
#Cross-validation against the final choice set happens after all specs merge.
if {![punk::args::lib::string_is_dict $specval]} {
error "punk::args::resolve - invalid value for key '$spec' in specifications for argument '$argname' - value must be a dictionary of alias -> canonical-choice @id:$DEF_definition_id"
error "punk::args::resolve - -choicealiases for argument '$argname' maps alias '$ca_alias' to '$ca_canonical' which is not in -choices/-choicegroups @id:$DEF_definition_id"
}
if {$ca_alias in $ca_allchoices} {
error "punk::args::resolve - -choicealiases for argument '$argname' alias '$ca_alias' collides with a defined choice @id:$DEF_definition_id"
#generally we expect values to contain leading dashes only if -- specified. Otherwise no reliable way determine difference between bad flags and values
#If no eopts (--) specified we stop looking for opts at the first nondash encountered in a position we'd expect a dash - so without eopt, values could contain dashes - but not in first position after flags.
set bytecode_safe [x eval {tcl::unsupported::disassemble proc ::ensembletest}]
if {[catch {x eval {tcl::unsupported::disassemble proc ::ensembletest}} bytecode_safe]} {
#Tcl 9.1+ removes tcl::unsupported::* from safe interps - disassemble is instead a hidden command (tcl:unsupported:disassemble)
set bytecode_safe [interp invokehidden x tcl:unsupported:disassemble proc ::ensembletest]
}
if {$show} {
puts safe:
puts $bytecode_safe
@ -1311,14 +1314,27 @@ namespace eval punk::lib {
#tcl 8.7+ lseq significantly faster, especially for larger ranges
#The internal rep can be an 'arithseries' with no string representation
#support minimal set from to
proc range {from to {by 1}} {
proc range {from to {by ""}} {
#note inconsistency with lseq 1 10 by -9 vs lseq 1 10 by -10
#https://core.tcl-lang.org/tcl/tktview/999b6966b2
#lseq in Tcl 9.1+ no longer evaluates expression operands such as 4-1 (TIP 746)
#range continues to accept int[+-]int offset forms e.g `range 0 [llength $list]-1` (same contract as the non-lseq fallback below)
if {![string is double -strict $from]} {set from [offset_expr $from]}
if {![string is double -strict $to]} {set to [offset_expr $to]}
if {$by eq ""} {
#direction inferred - lseq produces a descending sequence when from > to (matching the non-lseq fallback below)
return [lseq $from $to]
}
if {![string is double -strict $by]} {set by [offset_expr $by]}
if {$by == 0} {
#documented range behaviour (and lseq behaviour prior to Tcl 9.1): a step of zero produces no results
return [list]
}
lseq $from $to by $by
}
} else {
#lseq accepts basic expressions e.g 4-2 for both arguments
#e.g we can do lseq 0 [llength $list]-1
#lseq prior to Tcl 9.1 (TIP 746) accepted basic expressions e.g 4-2 for both arguments
#range accepts int[+-]int offset forms in all branches e.g we can do range 0 [llength $list]-1
#if range is to be consistent with the lseq version above - it should support that, even though we don't support most lseq functionality in either wrapper.
#our range function doesn't support double like lseq does. (deliberate) review
#Aliases are accepted at parse (exact, and as prefix-calculation members when
#-choiceprefix applies) and normalize to their canonical choice in the parse
#result; usage display folds them into the canonical entry.
#Cross-validation against the final choice set happens after all specs merge.
if {![punk::args::lib::string_is_dict $specval]} {
error "punk::args::resolve - invalid value for key '$spec' in specifications for argument '$argname' - value must be a dictionary of alias -> canonical-choice @id:$DEF_definition_id"
error "punk::args::resolve - -choicealiases for argument '$argname' maps alias '$ca_alias' to '$ca_canonical' which is not in -choices/-choicegroups @id:$DEF_definition_id"
}
if {$ca_alias in $ca_allchoices} {
error "punk::args::resolve - -choicealiases for argument '$argname' alias '$ca_alias' collides with a defined choice @id:$DEF_definition_id"
#generally we expect values to contain leading dashes only if -- specified. Otherwise no reliable way determine difference between bad flags and values
#If no eopts (--) specified we stop looking for opts at the first nondash encountered in a position we'd expect a dash - so without eopt, values could contain dashes - but not in first position after flags.
set bytecode_safe [x eval {tcl::unsupported::disassemble proc ::ensembletest}]
if {[catch {x eval {tcl::unsupported::disassemble proc ::ensembletest}} bytecode_safe]} {
#Tcl 9.1+ removes tcl::unsupported::* from safe interps - disassemble is instead a hidden command (tcl:unsupported:disassemble)
set bytecode_safe [interp invokehidden x tcl:unsupported:disassemble proc ::ensembletest]
}
if {$show} {
puts safe:
puts $bytecode_safe
@ -1311,14 +1314,27 @@ namespace eval punk::lib {
#tcl 8.7+ lseq significantly faster, especially for larger ranges
#The internal rep can be an 'arithseries' with no string representation
#support minimal set from to
proc range {from to {by 1}} {
proc range {from to {by ""}} {
#note inconsistency with lseq 1 10 by -9 vs lseq 1 10 by -10
#https://core.tcl-lang.org/tcl/tktview/999b6966b2
#lseq in Tcl 9.1+ no longer evaluates expression operands such as 4-1 (TIP 746)
#range continues to accept int[+-]int offset forms e.g `range 0 [llength $list]-1` (same contract as the non-lseq fallback below)
if {![string is double -strict $from]} {set from [offset_expr $from]}
if {![string is double -strict $to]} {set to [offset_expr $to]}
if {$by eq ""} {
#direction inferred - lseq produces a descending sequence when from > to (matching the non-lseq fallback below)
return [lseq $from $to]
}
if {![string is double -strict $by]} {set by [offset_expr $by]}
if {$by == 0} {
#documented range behaviour (and lseq behaviour prior to Tcl 9.1): a step of zero produces no results
return [list]
}
lseq $from $to by $by
}
} else {
#lseq accepts basic expressions e.g 4-2 for both arguments
#e.g we can do lseq 0 [llength $list]-1
#lseq prior to Tcl 9.1 (TIP 746) accepted basic expressions e.g 4-2 for both arguments
#range accepts int[+-]int offset forms in all branches e.g we can do range 0 [llength $list]-1
#if range is to be consistent with the lseq version above - it should support that, even though we don't support most lseq functionality in either wrapper.
#our range function doesn't support double like lseq does. (deliberate) review