Browse Source

many punk::args and textblock changes

master
Julian Noble 5 days ago
parent
commit
80239a0246
  1. 2
      src/bootsupport/modules/fauxlink-0.1.0.tm
  2. 4
      src/bootsupport/modules/fauxlink-0.1.1.tm
  3. 5
      src/bootsupport/modules/overtype-1.6.5.tm
  4. 23
      src/bootsupport/modules/punk-0.1.tm
  5. 10
      src/bootsupport/modules/punk/aliascore-0.1.0.tm
  6. 150
      src/bootsupport/modules/punk/ansi-0.1.1.tm
  7. 721
      src/bootsupport/modules/punk/args-0.1.0.tm
  8. 6
      src/bootsupport/modules/punk/assertion-0.1.0.tm
  9. 8
      src/bootsupport/modules/punk/console-0.1.1.tm
  10. 1
      src/bootsupport/modules/punk/docgen-0.1.0.tm
  11. 932
      src/bootsupport/modules/punk/lib-0.1.1.tm
  12. 6
      src/bootsupport/modules/punk/mix/commandset/doc-0.1.0.tm
  13. 96
      src/bootsupport/modules/punk/mix/commandset/scriptwrap-0.1.0.tm
  14. 14
      src/bootsupport/modules/punk/nav/fs-0.1.0.tm
  15. 7
      src/bootsupport/modules/punk/ns-0.1.0.tm
  16. 10
      src/bootsupport/modules/punk/packagepreference-0.1.0.tm
  17. 2
      src/bootsupport/modules/punk/repo-0.1.1.tm
  18. 85
      src/bootsupport/modules/punk/trie-0.1.0.tm
  19. 104
      src/bootsupport/modules/punk/zip-0.1.1.tm
  20. 1173
      src/bootsupport/modules/textblock-0.1.2.tm
  21. 6
      src/modules/#modpod-modpodtest-999999.0a1.0/modpodtest-999999.0a1.0.tm
  22. 14
      src/modules/argparsingtest-999999.0a1.0.tm
  23. 76
      src/modules/patternpunk-1.1.tm
  24. 145
      src/modules/poshinfo-999999.0a1.0.tm
  25. 23
      src/modules/punk-0.1.tm
  26. 10
      src/modules/punk/aliascore-999999.0a1.0.tm
  27. 150
      src/modules/punk/ansi-999999.0a1.0.tm
  28. 721
      src/modules/punk/args-999999.0a1.0.tm
  29. 6
      src/modules/punk/assertion-999999.0a1.0.tm
  30. 10
      src/modules/punk/basictelnet-999999.0a1.0.tm
  31. 10
      src/modules/punk/blockletter-999999.0a1.0.tm
  32. 6
      src/modules/punk/cesu-999999.0a1.0.tm
  33. 8
      src/modules/punk/console-999999.0a1.0.tm
  34. 1
      src/modules/punk/docgen-999999.0a1.0.tm
  35. 6
      src/modules/punk/experiment-999999.0a1.0.tm
  36. 6
      src/modules/punk/island-999999.0a1.0.tm
  37. 932
      src/modules/punk/lib-999999.0a1.0.tm
  38. 6
      src/modules/punk/mix/commandset/doc-999999.0a1.0.tm
  39. 96
      src/modules/punk/mix/commandset/scriptwrap-999999.0a1.0.tm
  40. 14
      src/modules/punk/nav/fs-999999.0a1.0.tm
  41. 7
      src/modules/punk/ns-999999.0a1.0.tm
  42. 10
      src/modules/punk/packagepreference-999999.0a1.0.tm
  43. 20
      src/modules/punk/repl-0.1.tm
  44. 2
      src/modules/punk/repo-999999.0a1.0.tm
  45. 6
      src/modules/punk/rest-999999.0a1.0.tm
  46. 6
      src/modules/punk/sshrun-999999.0a1.0.tm
  47. 85
      src/modules/punk/trie-999999.0a1.0.tm
  48. 10
      src/modules/punk/uc-999999.0a1.0.tm
  49. 8
      src/modules/punk/winlnk-999999.0a1.0.tm
  50. 104
      src/modules/punk/zip-999999.0a1.0.tm
  51. 1173
      src/modules/textblock-999999.0a1.0.tm
  52. 4
      src/vendormodules/fauxlink-0.1.1.tm
  53. 5
      src/vendormodules/overtype-1.6.5.tm
  54. 14
      src/vfs/_vfscommon.vfs/modules/argparsingtest-0.1.0.tm
  55. 4
      src/vfs/_vfscommon.vfs/modules/fauxlink-0.1.1.tm
  56. BIN
      src/vfs/_vfscommon.vfs/modules/modpodtest-0.1.0.tm
  57. 5
      src/vfs/_vfscommon.vfs/modules/overtype-1.6.5.tm
  58. 76
      src/vfs/_vfscommon.vfs/modules/patternpunk-1.1.tm
  59. 145
      src/vfs/_vfscommon.vfs/modules/poshinfo-0.1.0.tm
  60. 23
      src/vfs/_vfscommon.vfs/modules/punk-0.1.tm
  61. 10
      src/vfs/_vfscommon.vfs/modules/punk/aliascore-0.1.0.tm
  62. 150
      src/vfs/_vfscommon.vfs/modules/punk/ansi-0.1.1.tm
  63. 721
      src/vfs/_vfscommon.vfs/modules/punk/args-0.1.0.tm
  64. 6
      src/vfs/_vfscommon.vfs/modules/punk/assertion-0.1.0.tm
  65. 10
      src/vfs/_vfscommon.vfs/modules/punk/basictelnet-0.1.0.tm
  66. 10
      src/vfs/_vfscommon.vfs/modules/punk/blockletter-0.1.0.tm
  67. 6
      src/vfs/_vfscommon.vfs/modules/punk/cesu-0.1.0.tm
  68. 8
      src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm
  69. 1
      src/vfs/_vfscommon.vfs/modules/punk/docgen-0.1.0.tm
  70. 6
      src/vfs/_vfscommon.vfs/modules/punk/experiment-0.1.0.tm
  71. 6
      src/vfs/_vfscommon.vfs/modules/punk/island-0.1.0.tm
  72. 932
      src/vfs/_vfscommon.vfs/modules/punk/lib-0.1.1.tm
  73. 6
      src/vfs/_vfscommon.vfs/modules/punk/mix/commandset/doc-0.1.0.tm
  74. 96
      src/vfs/_vfscommon.vfs/modules/punk/mix/commandset/scriptwrap-0.1.0.tm
  75. 14
      src/vfs/_vfscommon.vfs/modules/punk/nav/fs-0.1.0.tm
  76. 7
      src/vfs/_vfscommon.vfs/modules/punk/ns-0.1.0.tm
  77. 10
      src/vfs/_vfscommon.vfs/modules/punk/packagepreference-0.1.0.tm
  78. 20
      src/vfs/_vfscommon.vfs/modules/punk/repl-0.1.tm
  79. 2
      src/vfs/_vfscommon.vfs/modules/punk/repo-0.1.1.tm
  80. 6
      src/vfs/_vfscommon.vfs/modules/punk/rest-0.1.0.tm
  81. 6
      src/vfs/_vfscommon.vfs/modules/punk/sshrun-0.1.0.tm
  82. 85
      src/vfs/_vfscommon.vfs/modules/punk/trie-0.1.0.tm
  83. 10
      src/vfs/_vfscommon.vfs/modules/punk/uc-0.1.0.tm
  84. 8
      src/vfs/_vfscommon.vfs/modules/punk/winlnk-0.1.0.tm
  85. 104
      src/vfs/_vfscommon.vfs/modules/punk/zip-0.1.1.tm
  86. 1173
      src/vfs/_vfscommon.vfs/modules/textblock-0.1.2.tm

2
src/bootsupport/modules/fauxlink-0.1.0.tm

@ -34,7 +34,7 @@
#[para] The + symbol substitutes for forward-slashes.
#[para] Other chars can be encoded using url-like encoding - (but only up to %7E !)
#[para] We deliberately treat higher % sequences literally.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [heart]) can remain literal for linking to urls.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [lb]heart[rb]) can remain literal for linking to urls.
#[para] e.g if an actual + or # is required in a filename or path segment they can be encoded as %2B & %23
#[para] e.g a link to a file file#A.txt in parent dir could be:
#[para] file%23A.txt#..+file%23A.txt.fxlnk

4
src/bootsupport/modules/fauxlink-0.1.1.tm

@ -34,7 +34,7 @@
#[para] The + symbol substitutes for forward-slashes.
#[para] Other chars can be encoded using url-like encoding - (but only up to %7E !)
#[para] We deliberately treat higher % sequences literally.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [heart]) can remain literal for linking to urls.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [lb]heart[rb]) can remain literal for linking to urls.
#[para] e.g if an actual + or # is required in a filename or path segment they can be encoded as %2B & %23
#[para] e.g a link to a file file#A.txt in parent dir could be:
#[para] file%23A.txt#..+file%23A.txt.fxlnk
@ -46,7 +46,7 @@
#[para] The target being fully specified in the name means the file doesn't have to be read for the target to be determined
#[para] Extensions to behaviour should be added in the file as text data in Toml format,
#[para] with custom data being under a single application-chosen table name
#[para] The toplevel Toml table [fauxlink] is reserved for core extensions to this system.
#[para] The toplevel Toml table [lb]fauxlink[rb] is reserved for core extensions to this system.
#[para] Aside from the 2 used for delimiting (+ #)
#[para] certain characters which might normally be allowed in filesystems are required to be encoded
#[para] e.g space and tab are required to be %20 %09

5
src/bootsupport/modules/overtype-1.6.5.tm

@ -1366,7 +1366,8 @@ tcl::namespace::eval overtype {
if {$overflowlength > 0} {
#overlay line wider or equal
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -overflow [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
#review - we still expand_right for centred for now.. possibly should expand_both with ellipsis each end?
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
set rendered [tcl::dict::get $rinfo result]
set overflow_right [tcl::dict::get $rinfo overflow_right]
set unapplied [tcl::dict::get $rinfo unapplied]
@ -1547,7 +1548,7 @@ tcl::namespace::eval overtype {
} else {
#padded overtext
#lappend outputlines [renderline -insert_mode 0 -transparent $opt_transparent -startcolumn [expr {$left_exposed + 1}] $undertext $overtext]
#Note - we still need overflow here - as although the overtext is short - it may oveflow due to the startoffset
#Note - we still need overflow(exapnd_right) here - as although the overtext is short - it may oveflow due to the startoffset
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right $opt_overflow -startcolumn [expr {$left_exposed + 1 + $startoffset}] $undertext $overtext]
lappend outputlines [tcl::dict::get $rinfo result]
}

23
src/bootsupport/modules/punk-0.1.tm

@ -7326,21 +7326,28 @@ namespace eval punk {
if {$topic in [list tcl]} {
if {[punk::lib::system::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::system::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
if {[punk::lib::check::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::check::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
}
if {[punk::lib::system::has_tclbug_safeinterp_compile]} {
if {[punk::lib::check::has_tclbug_safeinterp_compile]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_safeinterp returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_safeinterp returned true!" \n
append warningblock "${indent}(ensemble commands not compiled in safe interps - heavy performance impact in safe interps)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/1095bf7f75"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/1095bf7f75]"
append warningblock [a]
}
if {[punk::lib::system::has_tclbug_list_quoting_emptyjoin]} {
if {[punk::lib::check::has_tclbug_lsearch_strideallinline]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_list_quoting returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_lsearch_strideallinline returned true!" \n
append warningblock "${indent}(lsearch using -stride -all -inline -subindices does not return values corresponding to subindex when a single -index value is used)" \n
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/5a1aaa201d]"
append warningblock [a]
}
if {[punk::lib::check::has_tclbug_list_quoting_emptyjoin]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_list_quoting returned true!" \n
append warningblock "${indent}lists elements not properly quoted in some cases. e.g 'list {*}[lindex {etc #foo} 1] {*}[list]' (#foo not braced)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/e38dce74e2"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/e38dce74e2]"
}
}

10
src/bootsupport/modules/punk/aliascore-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::aliascore 0 0.1.0]
#[manpage_begin punkshell_module_punk::aliascore 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[titledesc {punkshell command aliases}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::aliascore]
#[keywords module]
#[keywords module alias]
#[description]
#[para] -

150
src/bootsupport/modules/punk/ansi-0.1.1.tm

@ -417,8 +417,11 @@ tcl::namespace::eval punk::ansi {
convert*\
clear*\
cursor_*\
delete*\
detect*\
erase*\
get_*\
hyperlink\
move*\
reset*\
ansistrip*\
@ -618,7 +621,7 @@ tcl::namespace::eval punk::ansi {
set subtitle [tcl::dict::get $picinfo status]
}
set title [tcl::dict::get $picinfo filename]
set fr [textblock::frame -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
set fr [textblock::frame -checkargs 0 -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
# -- --- --- ---
#we need the max height of a row element to use join_basic instead of join below
# -- --- --- ---
@ -3096,6 +3099,18 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
return "\033\[?25l"
}
# REVIEW - osc8 replays etc for split lines? - textblock
#the 'id' parameter logically connects split hyperlinks
proc hyperlink {uri {display ""}} {
if {$display eq ""} {
set display $uri
}
set params "" ;#todo e.g id=xyz123:foo=bar:baz=quux
set open "\x1b\]8\;$params\;$uri\x1b\\"
set close "\x1b\]8\;\;\x1b\\"
return ${open}${display}${close}
}
# -- --- --- --- ---
proc move {row col} {
#*** !doctools
@ -3634,11 +3649,27 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
}
set parts [punk::ansi::ta::split_codes $text]
set out ""
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
foreach {pt code} $parts {
append out $pt
}
return $out
}
proc ansistrip2 {text} {
#*** !doctools
#[call [fun ansistrip] [arg text] ]
#[para]Return a string with ansi codes stripped out
#[para]Alternate graphics chars are replaced with modern unicode equivalents (e.g boxdrawing glyphs)
if {[punk::ansi::ta::detect_g0 $text]} {
set text [convert_g0 $text];#Convert ansi borders to unicode line drawing instead of ascii letters
}
set parts [punk::ansi::ta::split_codes $text]
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
join [lmap v [lseq 0 to [llength $parts] by 2] {lindex $parts $v}] "" ;#slightly slower than above foreach
}
#interp alias {} stripansi {} ::punk::ansi::ansistrip
proc ansistripraw {text} {
#*** !doctools
@ -3842,8 +3873,9 @@ tcl::namespace::eval punk::ansi {
proc sgr_merge {codelist args} {
set allparts [list]
foreach c $codelist {
set cparts [punk::ansi::ta::split_codes_single $c]
lappend allparts {*}[lsearch -all -inline -not $cparts ""]
#set cparts [punk::ansi::ta::split_codes_single $c]
#lappend allparts {*}[lsearch -all -inline -not $cparts ""]
lappend allparts {*}[punk::ansi::ta::get_codes_single $c]
}
sgr_merge_singles $allparts {*}$args
}
@ -4362,10 +4394,12 @@ tcl::namespace::eval punk::ansi::ta {
# -- --- --- ---
variable re_ansi_detect1 "${re_csi_code}|${re_esc_osc1}|${re_esc_osc2}|${re_esc_osc3}|${re_standalones}|${re_ST}|${re_g0_open}|${re_g0_close}"
# -- --- --- ---
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regext TRIE generator that works with Tcl regexes
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regexp TRIE generator that works with Tcl regexes
#This does make things quicker - but it's too early to finalise the detect/split regexes (e.g missing \U0090 ) - will need to be redone.
variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
variable re_ansi_detect {(?:\x1b(?:\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\((?:0|B)|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
# -- --- --- ---
#variable re_csi_code {(?:\x1b\[|\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]}
@ -4389,9 +4423,7 @@ tcl::namespace::eval punk::ansi::ta {
#can be used on dicts - but will check keys too. keys could also contain ansi and have escapes
proc detect_in_list {list} {
detect [join $list " "]
}
proc detect_in_list2 {list} {
#loop is commonly faster than using join. (certain ansi codes triggering list quoting? review)
foreach item $list {
if {[detect $item]} {
return 1
@ -4399,6 +4431,11 @@ tcl::namespace::eval punk::ansi::ta {
}
return 0
}
#surprisingly - the ::join operation can be (relatively) slow on lists containing ansi
proc detect_in_list2 {list} {
detect [join $list " "]
}
proc detect_g0 {text} [string map [list <re> [list $re_g0_group]] {
regexp <re> $text
}]
@ -4580,13 +4617,108 @@ tcl::namespace::eval punk::ansi::ta {
#like split_codes - but each ansi-escape is split out separately (with empty string of plaintext between codes so odd/even plain ansi still holds)
#- the slightly simpler regex than split_codes means that it will be slightly faster than keeping the codes grouped.
proc split_codes_single {text} {
proc split_codes_single2 {text} {
variable re_ansi_split
return [_perlish_split $re_ansi_split $text]
}
proc split_codes_single3 {text} {
#copy from re_ansi_split
_perlish_split {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text
}
proc split_codes_single4 {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set re $re_ansi_split
#variable re_ansi_detect1
#set re $re_ansi_detect1
set list [list]
set start 0
#set re {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
#while {[regexp -start $start -indices -- {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text match]} {}
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
lappend list [tcl::string::range $text $start $matchStart-1]
if {$matchEnd < $matchStart} {
set e $matchStart
incr start
} else {
set e $matchEnd
set start [expr {$matchEnd+1}]
}
lappend list [tcl::string::range $text $matchStart $e]
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc split_codes_single {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re_ansi_split $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc get_codes_single {text} {
variable re_ansi_split
regexp -all -inline -- $re_ansi_split $text
}
#review - tcl greedy expressions may match multiple in one element
proc _perlish_split {re text} {
if {$text eq ""} {
return {}
}
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc _perlish_split2 {re text} {
if {$text eq ""} {
return {}
}
set list [list]
set start 0
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
if {$matchEnd < $matchStart} {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchStart]
incr start
} else {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchEnd]
set start [expr {$matchEnd+1}]
}
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc _perlish_split3 {re text} {
if {$text eq ""} {
return {}
}

721
src/bootsupport/modules/punk/args-0.1.0.tm

File diff suppressed because it is too large Load Diff

6
src/bootsupport/modules/punk/assertion-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::assertion 0 0.1.0]
#[manpage_begin punkshell_module_punk::assertion 0 0.1.0]
#[copyright "2024"]
#[titledesc {assertion alternative to control::assert}] [comment {-- Name section and table of contents description --}]
#[moddesc {per-namespace assertions with }] [comment {-- Description at end of page heading --}]

8
src/bootsupport/modules/punk/console-0.1.1.tm

@ -593,7 +593,13 @@ namespace eval punk::console {
if {!$::punk::console::ansi_available} {
return ""
}
set callid [info cmdcount] ;#info cmdcount is almost as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
# -- ---
#set callid [info cmdcount] ;#info cmdcount is fast, though not as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
#clock clicks is approx 2x faster - but can sometimes give duplicates if called sequentially e.g list [clock clicks] [clock clicks]
#Either is suitable here, where subsequent calls will be relatively far apart in time
#speed of call insignificant compared to function
set callid [clock clicks]
# -- ---
#
upvar ::punk::console::ansi_response_chunk accumulator

1
src/bootsupport/modules/punk/docgen-0.1.0.tm

@ -31,6 +31,7 @@ namespace eval punk::docgen {
error "get_doctools_comments file '$fname' not found"
}
set fd [open $fname r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {![string match "*#\**!doctools*" $data]} {

932
src/bootsupport/modules/punk/lib-0.1.1.tm

File diff suppressed because it is too large Load Diff

6
src/bootsupport/modules/punk/mix/commandset/doc-0.1.0.tm

@ -48,6 +48,7 @@ namespace eval punk::mix::commandset::doc {
set oldfiles [punk::path::treefilenames -dir $projectdir/src/doc _module_*.man]
foreach maybedoomed $oldfiles {
set fd [open $maybedoomed r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {[string match "*--- punk::docgen overwrites *" $data]} {
@ -170,7 +171,7 @@ namespace eval punk::mix::commandset::doc {
-- -type none -optional 1 -help "end of options marker --"
-individual -type boolean -default 1
*values -min 0 -max -1
patterns -default {*} -type any -multiple 1
patterns -default {*.man} -type any -multiple 1
} $args]
set opt_individual [tcl::dict::get $argd opts -individual]
set patterns [tcl::dict::get $argd values patterns]
@ -190,7 +191,7 @@ namespace eval punk::mix::commandset::doc {
set docroot $projectdir/src/doc
cd $docroot
if {!$opt_individual && "*" in $patterns} {
if {!$opt_individual && "*.man" in $patterns} {
if {[catch {
dtplite validate $docroot
} errM]} {
@ -251,6 +252,7 @@ namespace eval punk::mix::commandset::doc {
append docgen_header_comments {[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}]} \n
append docgen_header_comments {[comment {--- punk::docgen overwrites this file ---}]} \n
foreach fullpath $matched_paths {
puts stdout "do_docgen processing: $fullpath"
set doctools [punk::docgen::get_doctools_comments $fullpath]
if {$doctools ne ""} {
set fname [file tail $fullpath]

96
src/bootsupport/modules/punk/mix/commandset/scriptwrap-0.1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'dev make' or src/make.tcl to update from <pkg>-buildversion.txt
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -13,19 +13,70 @@
# @@ Meta End
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin punkshell_module_scriptwrap 0 0.1.0]
#[copyright "2024"]
#[titledesc {scriptwrap polyglot tool}] [comment {-- Name section and table of contents description --}]
#[moddesc {scriptwrap tool}] [comment {-- Description at end of page heading --}]
#[require punk::mix::commandset::scriptwrap]
#[keywords module commandset launcher scriptwrap]
#[description]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Overview]
#[para] overview of scriptwrap
#[subsection Concepts]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[subsection dependencies]
#[para] packages used by poshinfo
#[list_begin itemized]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
##e.g package require frobz
package require punk::lib
package require punk::args
package require punk::mix
package require punk::mix::base
package require punk::fileline
#*** !doctools
#[item] [package {Tcl 8.6}]
#[item] [package {punk::lib}]
#[item] [package {punk::args}]
#[item] [package {punk::mix}]
#[item] [package {punk::base}]
#[item] [package {punk::fileline}]
#*** !doctools
#[list_end]
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
namespace eval punk::mix::commandset::scriptwrap {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap}]
#[para] Core API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
namespace export *
namespace eval fileline {
@ -1192,22 +1243,33 @@ namespace eval punk::mix::commandset::scriptwrap {
return $result
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap ---}]
namespace eval lib {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::lib}]
#[para] Library API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
proc get_wrapper_folders {args} {
set argd [punk::args::get_dict {
#*** !doctools
#[call [fun get_wrapper_folders] [arg args] ]
#[para] Return list of dicts representing wrapper folders. keys: basefolder sourceinfo
#[para] Return list of dicts representing wrapper folders in the project. keys: basefolder sourceinfo
#[para] Arguments:
# [list_begin arguments]
# [arg_def string args] name-value pairs -scriptpath <path>
# [list_end]
*proc -name get_wrapper_folders
*id punk::mix::commandset::scriptwrap
*proc -name punk::mix::commandset::get_wrapper_folders
*opts -anyopts 0
-scriptpath -default ""
-scriptpath -default "" -type directory\
-help ""
#todo -help folder within a punk.templates provided area???
*values -minvalues 0 -maxvalues 0
} $args]
@ -1377,11 +1439,16 @@ namespace eval punk::mix::commandset::scriptwrap {
return [dict create ok $status linecount [llength $lines] data $tags errors $errors]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::lib ---}]
}
namespace eval batchlib {
#
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::batchlib}]
#[para] Utility funcions for processing windows .bat files
#[list_begin definitions]
#see also: https://www.dostips.com/forum/viewtopic.php?t=3803 'Rules for label names vs GOTO and CALL
# review - we may need different get_callsite_label functions?
@ -1647,23 +1714,13 @@ namespace eval punk::mix::commandset::scriptwrap {
#return rawlabel so we can see it as it appears in the data - as opposed to how it is interpreted as a label by cmd.exe
return [list labelfound 1 label $label rawlabel $rawlabel]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::batchlib ---}]
}
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::commandset::scriptwrap {
@ -1671,3 +1728,6 @@ package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::com
set version 0.1.0
}]
return
#*** !doctools
#[manpage_end]

14
src/bootsupport/modules/punk/nav/fs-0.1.0.tm

@ -20,10 +20,10 @@
#*** !doctools
#[manpage_begin shellspy_module_punk::nav::fs 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punk::nav::fs console filesystem navigation}] [comment {-- Name section and table of contents description --}]
#[moddesc {fs nav}] [comment {-- Description at end of page heading --}]
#[require punk::nav::fs]
#[keywords module]
#[keywords module filesystem terminal]
#[description]
#[para] -
@ -936,7 +936,7 @@ tcl::namespace::eval punk::nav::fs {
#windows doesn't consider dotfiles as hidden - mac does (?)
#we add dotfiles to flaggedhidden list in case there is some other mechanism that has flagged items as hidden
if {$::tcl_platform(platform) ne "windows"} {
lappend flaggedhidden {*}[lsearch -all -inline [concat $dirs $files] ".*"]
lappend flaggedhidden {*}[lsearch -all -inline [list {*}$dirs {*}$files] ".*"]
#e.g we can have dupes in the case where there are vfs mounted files that appear as dirs
#as we will need to do a (nat)sort as a last step - it will be faster to not sort items prematurely
#set flaggedhidden [lsort -unique $flaggedhidden]
@ -977,7 +977,8 @@ tcl::namespace::eval punk::nav::fs {
# -- ---
foreach nm [concat $dirs $files] {
#jmn
foreach nm [list {*}$dirs {*}$files] {
if {[punk::winpath::illegalname_test $nm]} {
lappend nonportable $nm
}
@ -1272,7 +1273,8 @@ tcl::namespace::eval punk::nav::fs {
#set widest1 [punk::pipedata [list {*}$dirs ""] {lmap v $data {string length $v}} {tcl::mathfunc::max {*}$data}]
set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
#set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list {*}$dirs ""] {string length $v}]]
set displaylist [list]
set col1 [string repeat " " [expr {$widest1 + 2}]]

7
src/bootsupport/modules/punk/ns-0.1.0.tm

@ -755,7 +755,9 @@ tcl::namespace::eval punk::ns {
set seencmds [list]
set masked [list] ;#
set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
#jmn
#set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
set cmdsets [list {*}$procs {*}$ensembles {*}$ooclasses {*}$ooobjects {*}$ooprivateobjects {*}$ooprivateclasses {*}$native {*}$interps {*}$coroutines {*}$zlibstreams]
foreach a $aliases {
if {[list c $a] in $elements} {
#possibly an ordinary alias - or a renamed alias that is masked by a proc/ensemble/oo
@ -1691,7 +1693,8 @@ tcl::namespace::eval punk::ns {
proc _pkguse_vars {varnames} {
while {"pkguse_vars_[incr n]" in $varnames} {}
return [concat $varnames pkguse_vars_$n]
#return [concat $varnames pkguse_vars_$n]
return [list {*}$varnames pkguse_vars_$n]
}
proc tracehandler_nowrite {args} {
error "readonly in use block"

10
src/bootsupport/modules/punk/packagepreference-0.1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::packagepreference 0 0.1.0]
#[manpage_begin punkshell_module_punk::packagepreference 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punkshell package/module loading}] [comment {-- Name section and table of contents description --}]
#[moddesc {package/module load}] [comment {-- Description at end of page heading --}]
#[require punk::packagepreference]
#[keywords module]
#[keywords module package]
#[description]
#[para] -

2
src/bootsupport/modules/punk/repo-0.1.1.tm

@ -710,7 +710,7 @@ namespace eval punk::repo {
lappend col2_values [dict get $summary_dict $f]
}
set title1 ""
set widest1 [tcl::mathfunc::max {*}[lmap v [concat [list $title1] $col1_fields] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list $title1 {*}$col1_fields] {string length $v}]]
set col1 [string repeat " " $widest1]
set title2 ""
set widest2 [tcl::mathfunc::max {*}[lmap v [concat [list $title2] $col2_values] {string length $v}]]

85
src/bootsupport/modules/punk/trie-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::trie 0 0.1.0]
#[manpage_begin punkshell_module_punk::trie 0 0.1.0]
#[copyright "2010"]
#[titledesc {punk::trie API}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::trie}] [comment {-- Description at end of page heading --}]
@ -64,34 +64,34 @@ package require Tcl 8.6-
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::trie::class {
#*** !doctools
#[subsection {Namespace punk::trie::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #tcl::namespace::eval punk::trie::class {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #[subsection {Namespace punk::trie::class}]
# #[para] class definitions
# #if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #[list_begin enumerated]
#
# # oo::class create interface_sample1 {
# # #*** !doctools
# # #[enum] CLASS [class interface_sample1]
# # #[list_begin definitions]
#
# # method test {arg1} {
# # #*** !doctools
# # #[call class::interface_sample1 [method test] [arg arg1]]
# # #[para] test method
# # puts "test: $arg1"
# # }
#
# # #*** !doctools
# # #[list_end] [comment {-- end definitions interface_sample1}]
# # }
#
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# #[list_end] [comment {--- end class enumeration ---}]
# #}
# #}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
@ -114,11 +114,18 @@ tcl::namespace::eval punk::trie {
}
#namespace path ::punk::trie::log
#[para] class definitions
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
if {[tcl::info::commands [tcl::namespace::current]::trieclass] eq ""} {
#*** !doctools
#[list_begin enumerated]
oo::class create [tcl::namespace::current]::trieclass {
#*** !doctools
#[enum] CLASS [class trieclass]
#[list_begin definitions]
variable trie id
method matches {t what} {
@ -412,9 +419,8 @@ tcl::namespace::eval punk::trie {
}
set acc {}
foreach key [dict keys $t] {
lappend acc {*}[my flatten [dict get $t $key] $prefix$key]
dict for {key val} $t {
lappend acc {*}[my flatten $val $prefix$key]
}
return $acc
}
@ -484,8 +490,14 @@ tcl::namespace::eval punk::trie {
my insert $a
}
}
#*** !doctools
#[list_end] [comment {--- end definitions ---}]
}
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
set testlist [list blah x black blacken]
proc test1 {} {
#JMN
@ -516,14 +528,9 @@ tcl::namespace::eval punk::trie {
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
}
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
#[list_begin definitions]
@ -542,8 +549,6 @@ tcl::namespace::eval punk::trie {
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::trie ---}]
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++

104
src/bootsupport/modules/punk/zip-0.1.1.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -11,7 +11,7 @@
# @@ Meta Begin
# Application punk::zip 0.1.1
# Meta platform tcl
# Meta license <unspecified>
# Meta license MIT
# @@ Meta End
@ -19,12 +19,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::zip 0 0.1.1]
#[manpage_begin punkshell_module_punk::zip 0 0.1.1]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::zip]
#[keywords module]
#[keywords module zip fileformat]
#[description]
#[para] -
@ -60,38 +60,6 @@ package require punk::args
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::zip::class {
#*** !doctools
#[subsection {Namespace punk::zip::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# Base namespace
@ -541,37 +509,60 @@ tcl::namespace::eval punk::zip {
#todo - doctools - [arg ?globs...?] syntax?
#*** !doctools
#[call [fun mkzip] [arg ?options?] [arg filename] ]
#[para] Create a zip archive in 'filename'
#[call [fun mkzip]\
# [opt "[option -offsettype] [arg offsettype]"]\
# [opt "[option -return] [arg returntype]"]\
# [opt "[option -zipkit] [arg 0|1]"]\
# [opt "[option -runtime] [arg preamble_filename]"]\
# [opt "[option -comment] [arg zipfilecomment]"]\
# [opt "[option -directory] [arg dir_to_zip]"]\
# [opt "[option -base] [arg archive_root]"]\
# [opt "[option -exclude] [arg globlist]"]\
# [arg zipfilename]\
# [arg ?glob...?]]
#[para] Create a zip archive in 'zipfilename'
#[para] If a file already exists, an error will be raised.
#[para] Call 'punk::zip::mkzip' with no arguments for usage display.
set argd [punk::args::get_dict {
*proc -name punk::zip::mkzip -help "Create a zip archive in 'filename'"
*proc -name punk::zip::mkzip\
-help "Create a zip archive in 'filename'"
*opts
-offsettype -default "archive" -choices {archive file} -help "zip offsets stored relative to start of entire file or relative to start of zip-archive
-offsettype -default "archive" -choices {archive file}\
-help "zip offsets stored relative to start of entire file or relative to start of zip-archive
Only relevant if the created file has a script/runtime prefix.
"
-return -default "pretty" -choices {pretty list none} -help "mkzip can return a list of the files and folders added to the archive
-return -default "pretty" -choices {pretty list none}\
-help "mkzip can return a list of the files and folders added to the archive
the option -return pretty is the default and uses the punk::lib pdict/plist system
to return a formatted list for the terminal
"
-zipkit -default 0 -type none -help "whether to add mounting script
-zipkit -default 0 -type none\
-help "whether to add mounting script
mutually exclusive with -runtime option
currently vfs::zip based - todo - autodetect zipfs/vfs with pref for zipfs
"
-runtime -default "" -help "specify a prefix file
-runtime -default ""\
-help "specify a prefix file
e.g punk::zip::mkzip -runtime unzipsfx.exe -directory subdir -base subdir output.zip
will create a self-extracting zip archive from the subdir/ folder.
Expects runtime with no existing vfs attached (review)
"
-comment -default "" -help "An optional comment for the archive"
-directory -default "" -help "The new zip archive will scan for contents within this folder or current directory if not provided"
-base -default "" -help "The new zip archive will be rooted in this directory if provided
-comment -default ""\
-help "An optional comment for the archive"
-directory -default ""\
-help "The new zip archive will scan for contents within this folder or current directory if not provided."
-base -default ""\
-help "The new zip archive will be rooted in this directory if provided
it must be a parent of -directory or the same path as -directory"
-exclude -default {CVS/* */CVS/* *~ ".#*" "*/.#*"}
*values -min 1 -max -1
filename -type file -default "" -help "name of zipfile to create"
globs -default {*} -multiple 1 -help "list of glob patterns to match.
Only directories with matching files will be included in the archive"
filename -type file -default ""\
-help "name of zipfile to create"
globs -default {*} -multiple 1\
-help "list of glob patterns to match.
Only directories with matching files will be included in the archive."
} $args]
set filename [dict get $argd values filename]
@ -733,7 +724,7 @@ tcl::namespace::eval punk::zip {
}
set cdoffset [tell $zf]
set endrec [binary format a4ssssiis PK\05\06 0 0 \
$count $count [string length $cd] $cdoffset\
$count $count [string length $cd] [expr {$cdoffset - $dataStartOffset}]\
[string length $opts(-comment)]]
append endrec $opts(-comment)
puts -nonewline $zf $cd
@ -793,17 +784,6 @@ tcl::namespace::eval punk::zip::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
#tcl::namespace::eval punk::zip::system {
#*** !doctools
#[subsection {Namespace punk::zip::system}]
#[para] Internal functions that are not part of the API
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::zip [tcl::namespace::eval punk::zip {

1173
src/bootsupport/modules/textblock-0.1.2.tm

File diff suppressed because it is too large Load Diff

6
src/modules/#modpod-modpodtest-999999.0a1.0/modpodtest-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_modpodtest 0 999999.0a1.0]
#[manpage_begin punkshell_module_modpodtest 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]

14
src/modules/argparsingtest-999999.0a1.0.tm

@ -1,16 +1,16 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) 2024
# (C) Julian Noble 2024
#
# @@ Meta Begin
# Application argparsingtest 999999.0a1.0
# Meta platform tcl
# Meta license <unspecified>
# Meta license MIT
# @@ Meta End
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_argparsingtest 0 999999.0a1.0]
#[manpage_begin punkshell_module_argparsingtest 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
@ -277,7 +277,7 @@ namespace eval argparsingtest {
#punk::args is slower than argp - but comparable, and argp doesn't support solo flags
proc test1_punkargs {args} {
set argd [punk::args::get_dict {
*proc -name argtest4 -description "test of punk::args::get_dict comparative performance"
*proc -name argtest4 -help "test of punk::args::get_dict comparative performance"
*opts -anyopts 0
-return -default string -type string
-frametype -default \uFFEF -type string
@ -296,7 +296,7 @@ namespace eval argparsingtest {
}
proc test1_punkargs_validate_without_ansi {args} {
set argd [punk::args::get_dict {
*proc -name argtest4 -description "test of punk::args::get_dict comparative performance"
*proc -name argtest4 -help "test of punk::args::get_dict comparative performance"
*opts -anyopts 0
-return -default string -type string -choices {string object} -help "return type"
-frametype -default \uFFEF -type string

76
src/modules/patternpunk-1.1.tm

@ -13,6 +13,7 @@
package require pattern
package require overtype
package require punk::ansi
package require punk::lib
pattern::init
@ -108,6 +109,45 @@ proc TCL {args} {
}
return $version
}
>punk .. Method poses {args} {
set argd [punk::args::get_dict {
*proc -name ">punk . poses" -help "Show or list the poses for the Punk mascot"
-censored -default 1 -type boolean -help "Set true to include mild toilet humour poses"
-return -default table -choices {list table}
} $args]
set censored [dict get $argd opts -censored]
set return [dict get $argd opts -return]
set poses [list\
front\
back\
lhs\
left\
rhs\
right\
lhs_air\
rhs_air\
lhs_hips\
rhs_hips\
lhs_bend\
rhs_bend\
lhs_thrust\
rhs_thrust\
]
if {!$censored} {
#allow toilet humour
lappend poses piss poop
}
if {$return eq "list"} {
return $poses
}
set cells [list]
foreach pose $poses {
lappend cells "$pose\n\n[>punk . $pose]"
}
textblock::list_as_table -show_hseps 1 -columns 4 $cells
}
>punk .. Property front [string trim {
_|_
@ v @
@ -266,7 +306,7 @@ _+ +_
_- -_
\ // /
\\
_+_+
+_+_
} \n]
>punk .. Property rhs_thrust [string trim {
\\\_
@ -275,7 +315,7 @@ _+ +_
_- -_
\ \\ /
//
_+_+
+_+_
} \n]
>punk .. Property fossil [string trim {
@ -287,6 +327,38 @@ v \\_/
v_ /|\/ /
\__/
} \n]
>punk .. Method deck {args} {
#todo - themes?
set this @this@
set RST [a]
set punk_colour [a+ term-71] ;#term-darkseagreen4-b
set hbar_colour [a+ web-silver]
set vbar_colour [a+ web-steelblue]
set border_colour [a+ web-lightslategray]
set frame_type arc
set punk $punk_colour[$this . lhs_air]$RST
package require punk::args
set standard_frame_types [textblock::frametypes]
set argd [punk::args::get_dict [tstr -return string {
*proc -name "deck" -help "Punk Deck mascot"
-frame -default arc -choices "${$standard_frame_types}" -choicerestricted 0 -choiceprefix 1
-boxmap -default {} -type dict
-boxlimits -default {hl vl tlc blc trc brc} -help "Limit the border box to listed elements."
-border_colour -default ${$border_colour} -type ansistring -regexprepass {^$} -validationtransform {
-function stripansi -maxlen 0
}
-title -default "PATTERN" -type string
-subtitle -default "PUNK" -type string
*values -max 0
}] $args]
set frame_type [dict get $argd opts -frame]
set box_map [dict get $argd opts -boxmap]
set box_limits [dict get $argd opts -boxlimits]
set border_colour [dict get $argd opts -border_colour]
set title [dict get $argd opts -title]
set subtitle [dict get $argd opts -subtitle]
set punkdeck [overtype::right [overtype::left [textblock::frame -ansiborder $border_colour -type $frame_type -boxmap $box_map -boxlimits $box_limits -title $hbar_colour$title$RST -subtitle $hbar_colour$subtitle$RST $punk] "$vbar_colour\n\n\P\nU\nN\nK$RST"] "$vbar_colour\n\nD\nE\nC\nK"]
}
>punk .. Method gcross {{size 1} args} {
package require textblock
textblock::gcross {*}$args $size

145
src/modules/poshinfo-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_poshinfo 0 999999.0a1.0]
#[manpage_begin punkshell_module_poshinfo 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {poshinfo prompt theme tool}] [comment {-- Name section and table of contents description --}]
#[moddesc {POSH-related prompt tool}] [comment {-- Description at end of page heading --}]
#[require poshinfo]
#[keywords module]
#[keywords module terminal console theme prompt {prompt theme} POSH]
#[description]
#[para] -
@ -49,6 +49,7 @@ package require Tcl 8.6-
package require punk::config
package require json ;#tcllib
#toml, yaml?
package require punk::args
#*** !doctools
#[item] [package {Tcl 8.6}]
@ -71,9 +72,11 @@ package require json ;#tcllib
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval poshinfo::class {
#*** !doctools
#[subsection {Namespace poshinfo::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
@ -96,6 +99,7 @@ package require json ;#tcllib
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
@ -114,18 +118,6 @@ tcl::namespace::eval poshinfo {
#proc sample1 {p1 n args} {
# #*** !doctools
# #[call [fun sample1] [arg p1] [arg n] [opt {option value...}]]
# #[para]Description of sample1
# #[para] Arguments:
# # [list_begin arguments]
# # [arg_def tring p1] A description of string argument p1.
# # [arg_def integer n] A description of integer argument n.
# # [list_end]
# return "ok"
#}
proc info_from_filename {fname} {
#string based filename processing: we are deliberately avoiding test of file existence etc here
if {$fname eq ""} {
@ -137,7 +129,12 @@ tcl::namespace::eval poshinfo {
}
set ftail [file tail $fname]
set rootname [file rootname $ftail]
set format [string trimleft [file extension $ftail] .]
set extension [string trimleft [file extension $ftail] .]
if {$extension eq "yml"} {
set format "yaml"
} else {
set format $extension
}
set parts [split $rootname .]
if {[lindex $parts end] eq "omp"} {
set type omp
@ -146,54 +143,122 @@ tcl::namespace::eval poshinfo {
if {$rootname eq "schema"} {
set type schema
} else {
#review - we can't tell diff betw <themename_with_dots>.<format> and <themename>.<unknowntype>.<format>
set type unknown
}
set shortname $rootname
}
return [dict create shortname $shortname format $format type $type]
return [dict create shortname $shortname format $format extension $extension type $type]
}
proc themes_dict {{globfor *}} {
#restrict glob to filename in filename.<type>.<format>
proc Themes_dict {{globlist *}} {
set running_config [punk::config::get running-config]
set posh_themes_path [tcl::dict::get $running_config posh_themes_path]
#posh_themes_path_extra ??
set themes [tcl::dict::create]
set themes_dict [tcl::dict::create]
if {[string length $posh_themes_path]} {
if {[file exists $posh_themes_path]} {
set files [glob -nocomplain -directory $posh_themes_path -tails $globfor]
set files [glob -nocomplain -directory $posh_themes_path -tails -- {*}$globlist]
foreach ftail $files {
set themeinfo [info_from_filename $ftail]
set shortname [dict get $themeinfo shortname]
set name_matched 0
foreach glob $globlist {
if {[string match -nocase $glob $shortname]} {
set name_matched 1
break
}
}
if {$name_matched} {
dict set themeinfo path [file join $posh_themes_path $ftail]
if {![dict exists $themes $shortname]} {
dict set themes $shortname [list $themeinfo]
if {![dict exists $themes_dict $shortname]} {
dict set themes_dict $shortname [list $themeinfo]
} else {
dict lappend themes $shortname $themeinfo
dict lappend themes_dict $shortname $themeinfo
}
}
}
}
}
return $themes_dict
}
proc get_active_theme {} {
lassign [punk::config::get running posh_theme] _ themepath
set theme_info [info_from_filename $themepath]
dict set theme_info path $themepath
}
proc set_active_theme_by_name {name} {
error "unimplemented"
}
proc set_active_theme_by_path {path} {
error "unimplemented"
}
proc themes {args} {
set argd [punk::args::get_dict {
*id poshinfo::themes
*proc -name poshinfo::themes
-format -default all -multiple 1 -choices {all yaml json}\
-help "File format of posh theme - based on file extension"
-type -default all -multiple 1\
-help "e.g omp"
-as -default "table" -choices {list showlist dict showdict table tableobject plaintext}\
-help "return type of result"
*values -min 0
globs -multiple 1 -default * -help ""
} $args]
set return_as [dict get $argd opts -as]
set formats [dict get $argd opts -format] ;#multiple
if {"yaml" in $formats} {
lappend formats "yml" ;#unpreferred extension for yaml - but accepted
}
return $themes
set types [dict get $argd opts -type] ;#multiple
set globlist [dict get $argd values globs]
set themes_dict [Themes_dict $globlist]
set restricted_themes_dict [dict create]
dict for {shortname themeinfolist} $themes_dict {
set themeinfo [lindex $themeinfolist 0]
if {("all" in $formats || [dict get $themeinfo format] in $formats) && ("all" in $types || [dict get $themeinfo type] in $types)} {
dict set restricted_themes_dict $shortname $themeinfolist
}
}
unset themes_dict
switch -- $return_as {
dict {
return $restricted_themes_dict
}
showdict {
return [showdict $restricted_themes_dict */@*/@*.@*]
}
proc themes {{globfor *}} {
set themes [themes_dict $globfor]
list {
return [dict keys $restricted_themes_dict]
}
showlist {
return [showlist [dict keys $restricted_themes_dict]]
}
}
set posh_theme [file normalize [punk::config::get_running_global posh_theme]]
set t [textblock::class::table new "Posh Themes"]
$t configure -show_header 1 -show_hseps 0
$t add_column -headers Shortname
$t add_column -headers Path
dict for {shortname themeinfolist} $themes {
dict for {shortname themeinfolist} $restricted_themes_dict {
#hack - support just one for now
set themeinfo [lindex $themeinfolist 0]
set path [dict get $themeinfo path]
$t add_row [list $shortname $path]
set fg ""
set bg ""
switch -- [dict get $themeinfo type] {
schema {
set fg black
set bg Web-orange
}
omp {}
@ -212,9 +277,22 @@ tcl::namespace::eval poshinfo {
$t configure_row [expr {[$t row_count]-1}] -ansibase [a+ {*}$fg {*}$bg]
}
}
set result [$t print]
switch -- $return_as {
plaintext {
$t configure -frametype {}
set tabletext [$t print]
set pt [punk::ansi::ansistrip $tabletext]
return [join [lines_as_list -line trimline $pt] \n]
}
table {
set tabletext [$t print]
$t destroy
return $result
return $tabletext
}
tableobject {
return $t
}
}
}
@ -230,6 +308,7 @@ tcl::namespace::eval poshinfo {
tcl::namespace::eval poshinfo::lib {
tcl::namespace::export {[a-z]*} ;# Convention: export all lowercase
tcl::namespace::path [tcl::namespace::parent]
#*** !doctools
#[subsection {Namespace poshinfo::lib}]
#[para] Secondary functions that are part of the API
@ -254,7 +333,9 @@ tcl::namespace::eval poshinfo::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
#tcl::namespace::eval poshinfo::system {
#*** !doctools
#[subsection {Namespace poshinfo::system}]
#[para] Internal functions that are not part of the API

23
src/modules/punk-0.1.tm

@ -7326,21 +7326,28 @@ namespace eval punk {
if {$topic in [list tcl]} {
if {[punk::lib::system::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::system::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
if {[punk::lib::check::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::check::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
}
if {[punk::lib::system::has_tclbug_safeinterp_compile]} {
if {[punk::lib::check::has_tclbug_safeinterp_compile]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_safeinterp returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_safeinterp returned true!" \n
append warningblock "${indent}(ensemble commands not compiled in safe interps - heavy performance impact in safe interps)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/1095bf7f75"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/1095bf7f75]"
append warningblock [a]
}
if {[punk::lib::system::has_tclbug_list_quoting_emptyjoin]} {
if {[punk::lib::check::has_tclbug_lsearch_strideallinline]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_list_quoting returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_lsearch_strideallinline returned true!" \n
append warningblock "${indent}(lsearch using -stride -all -inline -subindices does not return values corresponding to subindex when a single -index value is used)" \n
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/5a1aaa201d]"
append warningblock [a]
}
if {[punk::lib::check::has_tclbug_list_quoting_emptyjoin]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_list_quoting returned true!" \n
append warningblock "${indent}lists elements not properly quoted in some cases. e.g 'list {*}[lindex {etc #foo} 1] {*}[list]' (#foo not braced)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/e38dce74e2"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/e38dce74e2]"
}
}

10
src/modules/punk/aliascore-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::aliascore 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::aliascore 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[titledesc {punkshell command aliases}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::aliascore]
#[keywords module]
#[keywords module alias]
#[description]
#[para] -

150
src/modules/punk/ansi-999999.0a1.0.tm

@ -417,8 +417,11 @@ tcl::namespace::eval punk::ansi {
convert*\
clear*\
cursor_*\
delete*\
detect*\
erase*\
get_*\
hyperlink\
move*\
reset*\
ansistrip*\
@ -618,7 +621,7 @@ tcl::namespace::eval punk::ansi {
set subtitle [tcl::dict::get $picinfo status]
}
set title [tcl::dict::get $picinfo filename]
set fr [textblock::frame -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
set fr [textblock::frame -checkargs 0 -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
# -- --- --- ---
#we need the max height of a row element to use join_basic instead of join below
# -- --- --- ---
@ -3096,6 +3099,18 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
return "\033\[?25l"
}
# REVIEW - osc8 replays etc for split lines? - textblock
#the 'id' parameter logically connects split hyperlinks
proc hyperlink {uri {display ""}} {
if {$display eq ""} {
set display $uri
}
set params "" ;#todo e.g id=xyz123:foo=bar:baz=quux
set open "\x1b\]8\;$params\;$uri\x1b\\"
set close "\x1b\]8\;\;\x1b\\"
return ${open}${display}${close}
}
# -- --- --- --- ---
proc move {row col} {
#*** !doctools
@ -3634,11 +3649,27 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
}
set parts [punk::ansi::ta::split_codes $text]
set out ""
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
foreach {pt code} $parts {
append out $pt
}
return $out
}
proc ansistrip2 {text} {
#*** !doctools
#[call [fun ansistrip] [arg text] ]
#[para]Return a string with ansi codes stripped out
#[para]Alternate graphics chars are replaced with modern unicode equivalents (e.g boxdrawing glyphs)
if {[punk::ansi::ta::detect_g0 $text]} {
set text [convert_g0 $text];#Convert ansi borders to unicode line drawing instead of ascii letters
}
set parts [punk::ansi::ta::split_codes $text]
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
join [lmap v [lseq 0 to [llength $parts] by 2] {lindex $parts $v}] "" ;#slightly slower than above foreach
}
#interp alias {} stripansi {} ::punk::ansi::ansistrip
proc ansistripraw {text} {
#*** !doctools
@ -3842,8 +3873,9 @@ tcl::namespace::eval punk::ansi {
proc sgr_merge {codelist args} {
set allparts [list]
foreach c $codelist {
set cparts [punk::ansi::ta::split_codes_single $c]
lappend allparts {*}[lsearch -all -inline -not $cparts ""]
#set cparts [punk::ansi::ta::split_codes_single $c]
#lappend allparts {*}[lsearch -all -inline -not $cparts ""]
lappend allparts {*}[punk::ansi::ta::get_codes_single $c]
}
sgr_merge_singles $allparts {*}$args
}
@ -4362,10 +4394,12 @@ tcl::namespace::eval punk::ansi::ta {
# -- --- --- ---
variable re_ansi_detect1 "${re_csi_code}|${re_esc_osc1}|${re_esc_osc2}|${re_esc_osc3}|${re_standalones}|${re_ST}|${re_g0_open}|${re_g0_close}"
# -- --- --- ---
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regext TRIE generator that works with Tcl regexes
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regexp TRIE generator that works with Tcl regexes
#This does make things quicker - but it's too early to finalise the detect/split regexes (e.g missing \U0090 ) - will need to be redone.
variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
variable re_ansi_detect {(?:\x1b(?:\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\((?:0|B)|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
# -- --- --- ---
#variable re_csi_code {(?:\x1b\[|\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]}
@ -4389,9 +4423,7 @@ tcl::namespace::eval punk::ansi::ta {
#can be used on dicts - but will check keys too. keys could also contain ansi and have escapes
proc detect_in_list {list} {
detect [join $list " "]
}
proc detect_in_list2 {list} {
#loop is commonly faster than using join. (certain ansi codes triggering list quoting? review)
foreach item $list {
if {[detect $item]} {
return 1
@ -4399,6 +4431,11 @@ tcl::namespace::eval punk::ansi::ta {
}
return 0
}
#surprisingly - the ::join operation can be (relatively) slow on lists containing ansi
proc detect_in_list2 {list} {
detect [join $list " "]
}
proc detect_g0 {text} [string map [list <re> [list $re_g0_group]] {
regexp <re> $text
}]
@ -4580,13 +4617,108 @@ tcl::namespace::eval punk::ansi::ta {
#like split_codes - but each ansi-escape is split out separately (with empty string of plaintext between codes so odd/even plain ansi still holds)
#- the slightly simpler regex than split_codes means that it will be slightly faster than keeping the codes grouped.
proc split_codes_single {text} {
proc split_codes_single2 {text} {
variable re_ansi_split
return [_perlish_split $re_ansi_split $text]
}
proc split_codes_single3 {text} {
#copy from re_ansi_split
_perlish_split {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text
}
proc split_codes_single4 {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set re $re_ansi_split
#variable re_ansi_detect1
#set re $re_ansi_detect1
set list [list]
set start 0
#set re {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
#while {[regexp -start $start -indices -- {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text match]} {}
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
lappend list [tcl::string::range $text $start $matchStart-1]
if {$matchEnd < $matchStart} {
set e $matchStart
incr start
} else {
set e $matchEnd
set start [expr {$matchEnd+1}]
}
lappend list [tcl::string::range $text $matchStart $e]
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc split_codes_single {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re_ansi_split $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc get_codes_single {text} {
variable re_ansi_split
regexp -all -inline -- $re_ansi_split $text
}
#review - tcl greedy expressions may match multiple in one element
proc _perlish_split {re text} {
if {$text eq ""} {
return {}
}
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc _perlish_split2 {re text} {
if {$text eq ""} {
return {}
}
set list [list]
set start 0
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
if {$matchEnd < $matchStart} {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchStart]
incr start
} else {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchEnd]
set start [expr {$matchEnd+1}]
}
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc _perlish_split3 {re text} {
if {$text eq ""} {
return {}
}

721
src/modules/punk/args-999999.0a1.0.tm

File diff suppressed because it is too large Load Diff

6
src/modules/punk/assertion-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::assertion 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::assertion 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {assertion alternative to control::assert}] [comment {-- Name section and table of contents description --}]
#[moddesc {per-namespace assertions with }] [comment {-- Description at end of page heading --}]

10
src/modules/punk/basictelnet-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::basictelnet 0 999999.0a1.0]
#[manpage_begin punkshell::basictelnet 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {basic telnet client - DKF/Wiki}] [comment {-- Name section and table of contents description --}]
#[moddesc {basic telnet client}] [comment {-- Description at end of page heading --}]
#[require punk::basictelnet]
#[keywords module]
#[keywords module telnet protocol console terminal]
#[description]
#[para] see https://wiki.tcl-lang.org/page/Tcl+Telnet
@ -407,7 +407,7 @@ namespace eval punk::basictelnet {
set RST "\x1b\[m"
set debug_width 80
set infoframe [textblock::frame -width $debug_width -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug $terminal_type (encoding guess:$encoding_guess)$RST" $info]
set infoframe [textblock::frame -checkargs 0 -width $debug_width -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug $terminal_type (encoding guess:$encoding_guess)$RST" $info]
#set w [textblock::width $infoframe]
set spacepatch "$RST[textblock::block $debug_width 4 { }]"
#puts -nonewline [punk::ansi::cursor_off]

10
src/modules/punk/blockletter-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::blockletter 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::blockletter 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {punk::blockletter frame-based large lettering test/logo}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
@ -299,10 +299,10 @@ tcl::namespace::eval punk::blockletter::lib {
set h_in [expr {$h -2}]
if {$w_in > 0 && $h_in > 0} {
set inner [textblock::block $w_in $h_in \u00a0] ;#NBSP
textblock::frame -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg] $inner
textblock::frame -checkargs 0 -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg] $inner
} else {
#important to use no content arg - as empty string has 'height' of 1 in the textblock context (min height of any string is 1 row in the console)
textblock::frame -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg]
textblock::frame -checkargs 0 -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg]
}
}

6
src/modules/punk/cesu-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -19,7 +19,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::cesu 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::cesu 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {CESU compatibility ehcoding scheme for utf-16: 8-Bit (CESU-8) ??}] [comment {-- Name section and table of contents description --}]
#[moddesc {CESU experimental}] [comment {-- Description at end of page heading --}]

8
src/modules/punk/console-999999.0a1.0.tm

@ -593,7 +593,13 @@ namespace eval punk::console {
if {!$::punk::console::ansi_available} {
return ""
}
set callid [info cmdcount] ;#info cmdcount is almost as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
# -- ---
#set callid [info cmdcount] ;#info cmdcount is fast, though not as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
#clock clicks is approx 2x faster - but can sometimes give duplicates if called sequentially e.g list [clock clicks] [clock clicks]
#Either is suitable here, where subsequent calls will be relatively far apart in time
#speed of call insignificant compared to function
set callid [clock clicks]
# -- ---
#
upvar ::punk::console::ansi_response_chunk accumulator

1
src/modules/punk/docgen-999999.0a1.0.tm

@ -31,6 +31,7 @@ namespace eval punk::docgen {
error "get_doctools_comments file '$fname' not found"
}
set fd [open $fname r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {![string match "*#\**!doctools*" $data]} {

6
src/modules/punk/experiment-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::experiment 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::experiment 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]

6
src/modules/punk/island-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -32,7 +32,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::island 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::island 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {filesystem islands for safe interps}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::island for safe interps}] [comment {-- Description at end of page heading --}]

932
src/modules/punk/lib-999999.0a1.0.tm

File diff suppressed because it is too large Load Diff

6
src/modules/punk/mix/commandset/doc-999999.0a1.0.tm

@ -48,6 +48,7 @@ namespace eval punk::mix::commandset::doc {
set oldfiles [punk::path::treefilenames -dir $projectdir/src/doc _module_*.man]
foreach maybedoomed $oldfiles {
set fd [open $maybedoomed r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {[string match "*--- punk::docgen overwrites *" $data]} {
@ -170,7 +171,7 @@ namespace eval punk::mix::commandset::doc {
-- -type none -optional 1 -help "end of options marker --"
-individual -type boolean -default 1
*values -min 0 -max -1
patterns -default {*} -type any -multiple 1
patterns -default {*.man} -type any -multiple 1
} $args]
set opt_individual [tcl::dict::get $argd opts -individual]
set patterns [tcl::dict::get $argd values patterns]
@ -190,7 +191,7 @@ namespace eval punk::mix::commandset::doc {
set docroot $projectdir/src/doc
cd $docroot
if {!$opt_individual && "*" in $patterns} {
if {!$opt_individual && "*.man" in $patterns} {
if {[catch {
dtplite validate $docroot
} errM]} {
@ -251,6 +252,7 @@ namespace eval punk::mix::commandset::doc {
append docgen_header_comments {[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}]} \n
append docgen_header_comments {[comment {--- punk::docgen overwrites this file ---}]} \n
foreach fullpath $matched_paths {
puts stdout "do_docgen processing: $fullpath"
set doctools [punk::docgen::get_doctools_comments $fullpath]
if {$doctools ne ""} {
set fname [file tail $fullpath]

96
src/modules/punk/mix/commandset/scriptwrap-999999.0a1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'dev make' or src/make.tcl to update from <pkg>-buildversion.txt
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -13,19 +13,70 @@
# @@ Meta End
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin punkshell_module_scriptwrap 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {scriptwrap polyglot tool}] [comment {-- Name section and table of contents description --}]
#[moddesc {scriptwrap tool}] [comment {-- Description at end of page heading --}]
#[require punk::mix::commandset::scriptwrap]
#[keywords module commandset launcher scriptwrap]
#[description]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Overview]
#[para] overview of scriptwrap
#[subsection Concepts]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[subsection dependencies]
#[para] packages used by poshinfo
#[list_begin itemized]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
##e.g package require frobz
package require punk::lib
package require punk::args
package require punk::mix
package require punk::mix::base
package require punk::fileline
#*** !doctools
#[item] [package {Tcl 8.6}]
#[item] [package {punk::lib}]
#[item] [package {punk::args}]
#[item] [package {punk::mix}]
#[item] [package {punk::base}]
#[item] [package {punk::fileline}]
#*** !doctools
#[list_end]
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
namespace eval punk::mix::commandset::scriptwrap {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap}]
#[para] Core API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
namespace export *
namespace eval fileline {
@ -1192,22 +1243,33 @@ namespace eval punk::mix::commandset::scriptwrap {
return $result
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap ---}]
namespace eval lib {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::lib}]
#[para] Library API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
proc get_wrapper_folders {args} {
set argd [punk::args::get_dict {
#*** !doctools
#[call [fun get_wrapper_folders] [arg args] ]
#[para] Return list of dicts representing wrapper folders. keys: basefolder sourceinfo
#[para] Return list of dicts representing wrapper folders in the project. keys: basefolder sourceinfo
#[para] Arguments:
# [list_begin arguments]
# [arg_def string args] name-value pairs -scriptpath <path>
# [list_end]
*proc -name get_wrapper_folders
*id punk::mix::commandset::scriptwrap
*proc -name punk::mix::commandset::get_wrapper_folders
*opts -anyopts 0
-scriptpath -default ""
-scriptpath -default "" -type directory\
-help ""
#todo -help folder within a punk.templates provided area???
*values -minvalues 0 -maxvalues 0
} $args]
@ -1377,11 +1439,16 @@ namespace eval punk::mix::commandset::scriptwrap {
return [dict create ok $status linecount [llength $lines] data $tags errors $errors]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::lib ---}]
}
namespace eval batchlib {
#
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::batchlib}]
#[para] Utility funcions for processing windows .bat files
#[list_begin definitions]
#see also: https://www.dostips.com/forum/viewtopic.php?t=3803 'Rules for label names vs GOTO and CALL
# review - we may need different get_callsite_label functions?
@ -1647,23 +1714,13 @@ namespace eval punk::mix::commandset::scriptwrap {
#return rawlabel so we can see it as it appears in the data - as opposed to how it is interpreted as a label by cmd.exe
return [list labelfound 1 label $label rawlabel $rawlabel]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::batchlib ---}]
}
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::commandset::scriptwrap {
@ -1671,3 +1728,6 @@ package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::com
set version 999999.0a1.0
}]
return
#*** !doctools
#[manpage_end]

14
src/modules/punk/nav/fs-999999.0a1.0.tm

@ -20,10 +20,10 @@
#*** !doctools
#[manpage_begin shellspy_module_punk::nav::fs 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punk::nav::fs console filesystem navigation}] [comment {-- Name section and table of contents description --}]
#[moddesc {fs nav}] [comment {-- Description at end of page heading --}]
#[require punk::nav::fs]
#[keywords module]
#[keywords module filesystem terminal]
#[description]
#[para] -
@ -936,7 +936,7 @@ tcl::namespace::eval punk::nav::fs {
#windows doesn't consider dotfiles as hidden - mac does (?)
#we add dotfiles to flaggedhidden list in case there is some other mechanism that has flagged items as hidden
if {$::tcl_platform(platform) ne "windows"} {
lappend flaggedhidden {*}[lsearch -all -inline [concat $dirs $files] ".*"]
lappend flaggedhidden {*}[lsearch -all -inline [list {*}$dirs {*}$files] ".*"]
#e.g we can have dupes in the case where there are vfs mounted files that appear as dirs
#as we will need to do a (nat)sort as a last step - it will be faster to not sort items prematurely
#set flaggedhidden [lsort -unique $flaggedhidden]
@ -977,7 +977,8 @@ tcl::namespace::eval punk::nav::fs {
# -- ---
foreach nm [concat $dirs $files] {
#jmn
foreach nm [list {*}$dirs {*}$files] {
if {[punk::winpath::illegalname_test $nm]} {
lappend nonportable $nm
}
@ -1272,7 +1273,8 @@ tcl::namespace::eval punk::nav::fs {
#set widest1 [punk::pipedata [list {*}$dirs ""] {lmap v $data {string length $v}} {tcl::mathfunc::max {*}$data}]
set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
#set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list {*}$dirs ""] {string length $v}]]
set displaylist [list]
set col1 [string repeat " " [expr {$widest1 + 2}]]

7
src/modules/punk/ns-999999.0a1.0.tm

@ -755,7 +755,9 @@ tcl::namespace::eval punk::ns {
set seencmds [list]
set masked [list] ;#
set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
#jmn
#set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
set cmdsets [list {*}$procs {*}$ensembles {*}$ooclasses {*}$ooobjects {*}$ooprivateobjects {*}$ooprivateclasses {*}$native {*}$interps {*}$coroutines {*}$zlibstreams]
foreach a $aliases {
if {[list c $a] in $elements} {
#possibly an ordinary alias - or a renamed alias that is masked by a proc/ensemble/oo
@ -1691,7 +1693,8 @@ tcl::namespace::eval punk::ns {
proc _pkguse_vars {varnames} {
while {"pkguse_vars_[incr n]" in $varnames} {}
return [concat $varnames pkguse_vars_$n]
#return [concat $varnames pkguse_vars_$n]
return [list {*}$varnames pkguse_vars_$n]
}
proc tracehandler_nowrite {args} {
error "readonly in use block"

10
src/modules/punk/packagepreference-999999.0a1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::packagepreference 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::packagepreference 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punkshell package/module loading}] [comment {-- Name section and table of contents description --}]
#[moddesc {package/module load}] [comment {-- Description at end of page heading --}]
#[require punk::packagepreference]
#[keywords module]
#[keywords module package]
#[description]
#[para] -

20
src/modules/punk/repl-0.1.tm

@ -898,7 +898,7 @@ namespace eval punk::repl::class {
append debug \n $mergedinfo
append debug \n "input:[ansistring VIEW -lf 1 -vt 1 $new0] before row:$o_cursor_row after row: $result_row before col:$o_cursor_col after col:$result_col"
package require textblock
set debug [textblock::frame -buildcache 0 $debug]
set debug [textblock::frame -checkargs 0 -buildcache 0 $debug]
catch {punk::console::move_emitblock_return $debug_first_row 1 $debug}
# -- --- --- --- --- ---
@ -962,7 +962,7 @@ namespace eval punk::repl::class {
set debug "add_chunk$i"
append debug \n $mergedinfo
append debug \n "input:[ansistring VIEW -lf 1 -vt 1 $p]"
set debug [textblock::frame -buildcache 0 $debug]
set debug [textblock::frame -checkargs 0 -buildcache 0 $debug]
#catch {punk::console::move_emitblock_return [expr {$debug_first_row + ($i * 6)}] 1 $debug}
set result [dict get $mergedinfo result]
@ -1033,7 +1033,9 @@ namespace eval punk::repl::class {
#todo
#each newpart needs its grapheme split info to be stored
set o_rendered_lines [concat $o_rendered_lines [lrange $newparts 1 end]]
#jmn
#set o_rendered_lines [concat $o_rendered_lines [lrange $newparts 1 end]]
lappend o_rendered_lines {*}[lrange $newparts 1 end]
}
method linecount {} {
@ -1565,11 +1567,11 @@ proc punk::repl::console_debugview {editbuf consolewidth args} {
}
set debug_height [expr {[llength $lines]+2}] ;#framed height
} errM]} {
set info [textblock::frame -buildcache 0 -title "[a red]error$RST" $errM]
set info [textblock::frame -checkargs 0 -buildcache 0 -title "[a red]error$RST" $errM]
set debug_height [textblock::height $info]
} else {
#treat as ephemeral (unreusable) frames due to varying width & height - therefore set -buildcache 0
set info [textblock::frame -buildcache 0 -ansiborder [a+ bold green] -title "[a cyan]debugview_raw$RST" $info]
set info [textblock::frame -checkargs 0 -buildcache 0 -ansiborder [a+ bold green] -title "[a cyan]debugview_raw$RST" $info]
}
set debug_width [textblock::widthtopline $info]
@ -1604,14 +1606,14 @@ proc punk::repl::console_editbufview {editbuf consolewidth args} {
set info [punk::lib::list_as_lines $lines]
}
} editbuf_error]} {
set info [textblock::frame -buildcache 0 -title "[a red]error[a]" "$editbuf_error\n$::errorInfo"]
set info [textblock::frame -checkargs 0 -buildcache 0 -title "[a red]error[a]" "$editbuf_error\n$::errorInfo"]
} else {
set title "[a cyan]editbuf [expr {[llength $editbuf_list]-1}] lines [$editbuf linecount][a]"
append title "[a+ yellow bold] col:[format %3s [$editbuf cursor_column]] row:[$editbuf cursor_row][a]"
set row1 " lastchar:[ansistring VIEW -lf 1 [$editbuf last_char]] lastgrapheme:[ansistring VIEW -lf 1 [$editbuf last_grapheme]]"
set row2 " lastansi:[ansistring VIEW -lf 1 [$editbuf last_ansi]]"
set info [a+ green bold]$row1\n$row2[a]\n$info
set info [textblock::frame -buildcache 0 -ansiborder [a+ green bold] -title $title $info]
set info [textblock::frame -checkargs 0 -buildcache 0 -ansiborder [a+ green bold] -title $title $info]
}
set editbuf_width [textblock::widthtopline $info]
set spacepatch [textblock::block $editbuf_width 2 " "]
@ -1635,7 +1637,7 @@ proc punk::repl::console_controlnotification {message consolewidth consoleheight
set message [lindex $messagelines 0] ;#only allow single line
set info "[a+ bold red]$message[a]"
set hlt [dict get [textblock::framedef light] hlt]
set box [textblock::frame -boxmap [list tlc $hlt trc $hlt] -title $message -height 1]
set box [textblock::frame -checkargs 0 -boxmap [list tlc $hlt trc $hlt] -title $message -height 1]
set notification_width [textblock::widthtopline $info]
set box_offset [expr {$consolewidth - $notification_width - $opt_rightmargin}]
set row [expr {$consoleheight - $opt_bottommargin}]
@ -2155,7 +2157,7 @@ proc repl::repl_process_data {inputchan chunktype chunk stdinlines prompt_config
#-----------------------------------------
#list/string-rep bug workaround part 2
#todo - set flag based on punk::lib::system::has_tclbug_script_var
#todo - set flag based on punk::lib::check::has_tclbug_script_var
lappend run_command_cache $run_command_string
#puts stderr "run_command_string rep: [rep $run_command_string]"
if {[llength $run_command_cache] > 2000} {

2
src/modules/punk/repo-999999.0a1.0.tm

@ -710,7 +710,7 @@ namespace eval punk::repo {
lappend col2_values [dict get $summary_dict $f]
}
set title1 ""
set widest1 [tcl::mathfunc::max {*}[lmap v [concat [list $title1] $col1_fields] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list $title1 {*}$col1_fields] {string length $v}]]
set col1 [string repeat " " $widest1]
set title2 ""
set widest2 [tcl::mathfunc::max {*}[lmap v [concat [list $title2] $col2_values] {string length $v}]]

6
src/modules/punk/rest-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -19,7 +19,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::rest 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::rest 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {punk::rest}] [comment {-- Name section and table of contents description --}]
#[moddesc {experimental rest}] [comment {-- Description at end of page heading --}]

6
src/modules/punk/sshrun-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) 2009 Jose F. Nieves
@ -30,7 +30,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::sshrun 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::sshrun 0 999999.0a1.0]
#[copyright "2009"]
#[titledesc {Tcl procedures to execute tcl scripts in remote hosts}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::sshrun tclssh clone}] [comment {-- Description at end of page heading --}]

85
src/modules/punk/trie-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::trie 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::trie 0 999999.0a1.0]
#[copyright "2010"]
#[titledesc {punk::trie API}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::trie}] [comment {-- Description at end of page heading --}]
@ -64,34 +64,34 @@ package require Tcl 8.6-
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::trie::class {
#*** !doctools
#[subsection {Namespace punk::trie::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #tcl::namespace::eval punk::trie::class {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #[subsection {Namespace punk::trie::class}]
# #[para] class definitions
# #if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #[list_begin enumerated]
#
# # oo::class create interface_sample1 {
# # #*** !doctools
# # #[enum] CLASS [class interface_sample1]
# # #[list_begin definitions]
#
# # method test {arg1} {
# # #*** !doctools
# # #[call class::interface_sample1 [method test] [arg arg1]]
# # #[para] test method
# # puts "test: $arg1"
# # }
#
# # #*** !doctools
# # #[list_end] [comment {-- end definitions interface_sample1}]
# # }
#
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# #[list_end] [comment {--- end class enumeration ---}]
# #}
# #}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
@ -114,11 +114,18 @@ tcl::namespace::eval punk::trie {
}
#namespace path ::punk::trie::log
#[para] class definitions
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
if {[tcl::info::commands [tcl::namespace::current]::trieclass] eq ""} {
#*** !doctools
#[list_begin enumerated]
oo::class create [tcl::namespace::current]::trieclass {
#*** !doctools
#[enum] CLASS [class trieclass]
#[list_begin definitions]
variable trie id
method matches {t what} {
@ -412,9 +419,8 @@ tcl::namespace::eval punk::trie {
}
set acc {}
foreach key [dict keys $t] {
lappend acc {*}[my flatten [dict get $t $key] $prefix$key]
dict for {key val} $t {
lappend acc {*}[my flatten $val $prefix$key]
}
return $acc
}
@ -484,8 +490,14 @@ tcl::namespace::eval punk::trie {
my insert $a
}
}
#*** !doctools
#[list_end] [comment {--- end definitions ---}]
}
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
set testlist [list blah x black blacken]
proc test1 {} {
#JMN
@ -516,14 +528,9 @@ tcl::namespace::eval punk::trie {
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
}
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
#[list_begin definitions]
@ -542,8 +549,6 @@ tcl::namespace::eval punk::trie {
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::trie ---}]
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++

10
src/modules/punk/uc-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::uc 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::uc 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::uc]
#[keywords module]
#[keywords module unofficial unicode wcswidth]
#[description]
#[para] -
@ -35022,7 +35022,9 @@ namespace eval punk::uc::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
namespace eval punk::uc::system {
#*** !doctools
#[subsection {Namespace punk::uc::system}]
#[para] Internal functions that are not part of the API

8
src/modules/punk/winlnk-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::winlnk 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::winlnk 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {windows shortcut .lnk library}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::winlnk}] [comment {-- Description at end of page heading --}]
@ -34,7 +34,7 @@
#[para] overview of punk::winlnk
#[subsection Concepts]
#[para] Windows shortcuts are a binary format file with a .lnk extension
#[para] Shell Link (.LNK) Binary File Format is documented in [MS_SHLLINK].pdf published by Microsoft.
#[para] Shell Link (.LNK) Binary File Format is documented in [lb]MS_SHLLINK[rb].pdf published by Microsoft.
#[para] Revision 8.0 published 2024-04-23

104
src/modules/punk/zip-999999.0a1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -11,7 +11,7 @@
# @@ Meta Begin
# Application punk::zip 999999.0a1.0
# Meta platform tcl
# Meta license <unspecified>
# Meta license MIT
# @@ Meta End
@ -19,12 +19,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::zip 0 999999.0a1.0]
#[manpage_begin punkshell_module_punk::zip 0 999999.0a1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::zip]
#[keywords module]
#[keywords module zip fileformat]
#[description]
#[para] -
@ -60,38 +60,6 @@ package require punk::args
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::zip::class {
#*** !doctools
#[subsection {Namespace punk::zip::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# Base namespace
@ -541,37 +509,60 @@ tcl::namespace::eval punk::zip {
#todo - doctools - [arg ?globs...?] syntax?
#*** !doctools
#[call [fun mkzip] [arg ?options?] [arg filename] ]
#[para] Create a zip archive in 'filename'
#[call [fun mkzip]\
# [opt "[option -offsettype] [arg offsettype]"]\
# [opt "[option -return] [arg returntype]"]\
# [opt "[option -zipkit] [arg 0|1]"]\
# [opt "[option -runtime] [arg preamble_filename]"]\
# [opt "[option -comment] [arg zipfilecomment]"]\
# [opt "[option -directory] [arg dir_to_zip]"]\
# [opt "[option -base] [arg archive_root]"]\
# [opt "[option -exclude] [arg globlist]"]\
# [arg zipfilename]\
# [arg ?glob...?]]
#[para] Create a zip archive in 'zipfilename'
#[para] If a file already exists, an error will be raised.
#[para] Call 'punk::zip::mkzip' with no arguments for usage display.
set argd [punk::args::get_dict {
*proc -name punk::zip::mkzip -help "Create a zip archive in 'filename'"
*proc -name punk::zip::mkzip\
-help "Create a zip archive in 'filename'"
*opts
-offsettype -default "archive" -choices {archive file} -help "zip offsets stored relative to start of entire file or relative to start of zip-archive
-offsettype -default "archive" -choices {archive file}\
-help "zip offsets stored relative to start of entire file or relative to start of zip-archive
Only relevant if the created file has a script/runtime prefix.
"
-return -default "pretty" -choices {pretty list none} -help "mkzip can return a list of the files and folders added to the archive
-return -default "pretty" -choices {pretty list none}\
-help "mkzip can return a list of the files and folders added to the archive
the option -return pretty is the default and uses the punk::lib pdict/plist system
to return a formatted list for the terminal
"
-zipkit -default 0 -type none -help "whether to add mounting script
-zipkit -default 0 -type none\
-help "whether to add mounting script
mutually exclusive with -runtime option
currently vfs::zip based - todo - autodetect zipfs/vfs with pref for zipfs
"
-runtime -default "" -help "specify a prefix file
-runtime -default ""\
-help "specify a prefix file
e.g punk::zip::mkzip -runtime unzipsfx.exe -directory subdir -base subdir output.zip
will create a self-extracting zip archive from the subdir/ folder.
Expects runtime with no existing vfs attached (review)
"
-comment -default "" -help "An optional comment for the archive"
-directory -default "" -help "The new zip archive will scan for contents within this folder or current directory if not provided"
-base -default "" -help "The new zip archive will be rooted in this directory if provided
-comment -default ""\
-help "An optional comment for the archive"
-directory -default ""\
-help "The new zip archive will scan for contents within this folder or current directory if not provided."
-base -default ""\
-help "The new zip archive will be rooted in this directory if provided
it must be a parent of -directory or the same path as -directory"
-exclude -default {CVS/* */CVS/* *~ ".#*" "*/.#*"}
*values -min 1 -max -1
filename -type file -default "" -help "name of zipfile to create"
globs -default {*} -multiple 1 -help "list of glob patterns to match.
Only directories with matching files will be included in the archive"
filename -type file -default ""\
-help "name of zipfile to create"
globs -default {*} -multiple 1\
-help "list of glob patterns to match.
Only directories with matching files will be included in the archive."
} $args]
set filename [dict get $argd values filename]
@ -733,7 +724,7 @@ tcl::namespace::eval punk::zip {
}
set cdoffset [tell $zf]
set endrec [binary format a4ssssiis PK\05\06 0 0 \
$count $count [string length $cd] $cdoffset\
$count $count [string length $cd] [expr {$cdoffset - $dataStartOffset}]\
[string length $opts(-comment)]]
append endrec $opts(-comment)
puts -nonewline $zf $cd
@ -793,17 +784,6 @@ tcl::namespace::eval punk::zip::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
#tcl::namespace::eval punk::zip::system {
#*** !doctools
#[subsection {Namespace punk::zip::system}]
#[para] Internal functions that are not part of the API
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::zip [tcl::namespace::eval punk::zip {

1173
src/modules/textblock-999999.0a1.0.tm

File diff suppressed because it is too large Load Diff

4
src/vendormodules/fauxlink-0.1.1.tm

@ -34,7 +34,7 @@
#[para] The + symbol substitutes for forward-slashes.
#[para] Other chars can be encoded using url-like encoding - (but only up to %7E !)
#[para] We deliberately treat higher % sequences literally.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [heart]) can remain literal for linking to urls.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [lb]heart[rb]) can remain literal for linking to urls.
#[para] e.g if an actual + or # is required in a filename or path segment they can be encoded as %2B & %23
#[para] e.g a link to a file file#A.txt in parent dir could be:
#[para] file%23A.txt#..+file%23A.txt.fxlnk
@ -46,7 +46,7 @@
#[para] The target being fully specified in the name means the file doesn't have to be read for the target to be determined
#[para] Extensions to behaviour should be added in the file as text data in Toml format,
#[para] with custom data being under a single application-chosen table name
#[para] The toplevel Toml table [fauxlink] is reserved for core extensions to this system.
#[para] The toplevel Toml table [lb]fauxlink[rb] is reserved for core extensions to this system.
#[para] Aside from the 2 used for delimiting (+ #)
#[para] certain characters which might normally be allowed in filesystems are required to be encoded
#[para] e.g space and tab are required to be %20 %09

5
src/vendormodules/overtype-1.6.5.tm

@ -1366,7 +1366,8 @@ tcl::namespace::eval overtype {
if {$overflowlength > 0} {
#overlay line wider or equal
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -overflow [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
#review - we still expand_right for centred for now.. possibly should expand_both with ellipsis each end?
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
set rendered [tcl::dict::get $rinfo result]
set overflow_right [tcl::dict::get $rinfo overflow_right]
set unapplied [tcl::dict::get $rinfo unapplied]
@ -1547,7 +1548,7 @@ tcl::namespace::eval overtype {
} else {
#padded overtext
#lappend outputlines [renderline -insert_mode 0 -transparent $opt_transparent -startcolumn [expr {$left_exposed + 1}] $undertext $overtext]
#Note - we still need overflow here - as although the overtext is short - it may oveflow due to the startoffset
#Note - we still need overflow(exapnd_right) here - as although the overtext is short - it may oveflow due to the startoffset
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right $opt_overflow -startcolumn [expr {$left_exposed + 1 + $startoffset}] $undertext $overtext]
lappend outputlines [tcl::dict::get $rinfo result]
}

14
src/vfs/_vfscommon.vfs/modules/argparsingtest-0.1.0.tm

@ -1,16 +1,16 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) 2024
# (C) Julian Noble 2024
#
# @@ Meta Begin
# Application argparsingtest 0.1.0
# Meta platform tcl
# Meta license <unspecified>
# Meta license MIT
# @@ Meta End
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_argparsingtest 0 0.1.0]
#[manpage_begin punkshell_module_argparsingtest 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
@ -277,7 +277,7 @@ namespace eval argparsingtest {
#punk::args is slower than argp - but comparable, and argp doesn't support solo flags
proc test1_punkargs {args} {
set argd [punk::args::get_dict {
*proc -name argtest4 -description "test of punk::args::get_dict comparative performance"
*proc -name argtest4 -help "test of punk::args::get_dict comparative performance"
*opts -anyopts 0
-return -default string -type string
-frametype -default \uFFEF -type string
@ -296,7 +296,7 @@ namespace eval argparsingtest {
}
proc test1_punkargs_validate_without_ansi {args} {
set argd [punk::args::get_dict {
*proc -name argtest4 -description "test of punk::args::get_dict comparative performance"
*proc -name argtest4 -help "test of punk::args::get_dict comparative performance"
*opts -anyopts 0
-return -default string -type string -choices {string object} -help "return type"
-frametype -default \uFFEF -type string

4
src/vfs/_vfscommon.vfs/modules/fauxlink-0.1.1.tm

@ -34,7 +34,7 @@
#[para] The + symbol substitutes for forward-slashes.
#[para] Other chars can be encoded using url-like encoding - (but only up to %7E !)
#[para] We deliberately treat higher % sequences literally.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [heart]) can remain literal for linking to urls.
#[para] This means actual uri::urn encoded unicode sequences (e.g %E2%99%A5 [lb]heart[rb]) can remain literal for linking to urls.
#[para] e.g if an actual + or # is required in a filename or path segment they can be encoded as %2B & %23
#[para] e.g a link to a file file#A.txt in parent dir could be:
#[para] file%23A.txt#..+file%23A.txt.fxlnk
@ -46,7 +46,7 @@
#[para] The target being fully specified in the name means the file doesn't have to be read for the target to be determined
#[para] Extensions to behaviour should be added in the file as text data in Toml format,
#[para] with custom data being under a single application-chosen table name
#[para] The toplevel Toml table [fauxlink] is reserved for core extensions to this system.
#[para] The toplevel Toml table [lb]fauxlink[rb] is reserved for core extensions to this system.
#[para] Aside from the 2 used for delimiting (+ #)
#[para] certain characters which might normally be allowed in filesystems are required to be encoded
#[para] e.g space and tab are required to be %20 %09

BIN
src/vfs/_vfscommon.vfs/modules/modpodtest-0.1.0.tm

Binary file not shown.

5
src/vfs/_vfscommon.vfs/modules/overtype-1.6.5.tm

@ -1366,7 +1366,8 @@ tcl::namespace::eval overtype {
if {$overflowlength > 0} {
#overlay line wider or equal
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -overflow [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
#review - we still expand_right for centred for now.. possibly should expand_both with ellipsis each end?
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right [tcl::dict::get $opts -overflow] -exposed1 $opt_exposed1 -exposed2 $opt_exposed2 $undertext $overtext]
set rendered [tcl::dict::get $rinfo result]
set overflow_right [tcl::dict::get $rinfo overflow_right]
set unapplied [tcl::dict::get $rinfo unapplied]
@ -1547,7 +1548,7 @@ tcl::namespace::eval overtype {
} else {
#padded overtext
#lappend outputlines [renderline -insert_mode 0 -transparent $opt_transparent -startcolumn [expr {$left_exposed + 1}] $undertext $overtext]
#Note - we still need overflow here - as although the overtext is short - it may oveflow due to the startoffset
#Note - we still need overflow(exapnd_right) here - as although the overtext is short - it may oveflow due to the startoffset
set rinfo [renderline -info 1 -insert_mode 0 -transparent $opt_transparent -expand_right $opt_overflow -startcolumn [expr {$left_exposed + 1 + $startoffset}] $undertext $overtext]
lappend outputlines [tcl::dict::get $rinfo result]
}

76
src/vfs/_vfscommon.vfs/modules/patternpunk-1.1.tm

@ -13,6 +13,7 @@
package require pattern
package require overtype
package require punk::ansi
package require punk::lib
pattern::init
@ -108,6 +109,45 @@ proc TCL {args} {
}
return $version
}
>punk .. Method poses {args} {
set argd [punk::args::get_dict {
*proc -name ">punk . poses" -help "Show or list the poses for the Punk mascot"
-censored -default 1 -type boolean -help "Set true to include mild toilet humour poses"
-return -default table -choices {list table}
} $args]
set censored [dict get $argd opts -censored]
set return [dict get $argd opts -return]
set poses [list\
front\
back\
lhs\
left\
rhs\
right\
lhs_air\
rhs_air\
lhs_hips\
rhs_hips\
lhs_bend\
rhs_bend\
lhs_thrust\
rhs_thrust\
]
if {!$censored} {
#allow toilet humour
lappend poses piss poop
}
if {$return eq "list"} {
return $poses
}
set cells [list]
foreach pose $poses {
lappend cells "$pose\n\n[>punk . $pose]"
}
textblock::list_as_table -show_hseps 1 -columns 4 $cells
}
>punk .. Property front [string trim {
_|_
@ v @
@ -266,7 +306,7 @@ _+ +_
_- -_
\ // /
\\
_+_+
+_+_
} \n]
>punk .. Property rhs_thrust [string trim {
\\\_
@ -275,7 +315,7 @@ _+ +_
_- -_
\ \\ /
//
_+_+
+_+_
} \n]
>punk .. Property fossil [string trim {
@ -287,6 +327,38 @@ v \\_/
v_ /|\/ /
\__/
} \n]
>punk .. Method deck {args} {
#todo - themes?
set this @this@
set RST [a]
set punk_colour [a+ term-71] ;#term-darkseagreen4-b
set hbar_colour [a+ web-silver]
set vbar_colour [a+ web-steelblue]
set border_colour [a+ web-lightslategray]
set frame_type arc
set punk $punk_colour[$this . lhs_air]$RST
package require punk::args
set standard_frame_types [textblock::frametypes]
set argd [punk::args::get_dict [tstr -return string {
*proc -name "deck" -help "Punk Deck mascot"
-frame -default arc -choices "${$standard_frame_types}" -choicerestricted 0 -choiceprefix 1
-boxmap -default {} -type dict
-boxlimits -default {hl vl tlc blc trc brc} -help "Limit the border box to listed elements."
-border_colour -default ${$border_colour} -type ansistring -regexprepass {^$} -validationtransform {
-function stripansi -maxlen 0
}
-title -default "PATTERN" -type string
-subtitle -default "PUNK" -type string
*values -max 0
}] $args]
set frame_type [dict get $argd opts -frame]
set box_map [dict get $argd opts -boxmap]
set box_limits [dict get $argd opts -boxlimits]
set border_colour [dict get $argd opts -border_colour]
set title [dict get $argd opts -title]
set subtitle [dict get $argd opts -subtitle]
set punkdeck [overtype::right [overtype::left [textblock::frame -ansiborder $border_colour -type $frame_type -boxmap $box_map -boxlimits $box_limits -title $hbar_colour$title$RST -subtitle $hbar_colour$subtitle$RST $punk] "$vbar_colour\n\n\P\nU\nN\nK$RST"] "$vbar_colour\n\nD\nE\nC\nK"]
}
>punk .. Method gcross {{size 1} args} {
package require textblock
textblock::gcross {*}$args $size

145
src/vfs/_vfscommon.vfs/modules/poshinfo-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_poshinfo 0 0.1.0]
#[manpage_begin punkshell_module_poshinfo 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {poshinfo prompt theme tool}] [comment {-- Name section and table of contents description --}]
#[moddesc {POSH-related prompt tool}] [comment {-- Description at end of page heading --}]
#[require poshinfo]
#[keywords module]
#[keywords module terminal console theme prompt {prompt theme} POSH]
#[description]
#[para] -
@ -49,6 +49,7 @@ package require Tcl 8.6-
package require punk::config
package require json ;#tcllib
#toml, yaml?
package require punk::args
#*** !doctools
#[item] [package {Tcl 8.6}]
@ -71,9 +72,11 @@ package require json ;#tcllib
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval poshinfo::class {
#*** !doctools
#[subsection {Namespace poshinfo::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
@ -96,6 +99,7 @@ package require json ;#tcllib
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
@ -114,18 +118,6 @@ tcl::namespace::eval poshinfo {
#proc sample1 {p1 n args} {
# #*** !doctools
# #[call [fun sample1] [arg p1] [arg n] [opt {option value...}]]
# #[para]Description of sample1
# #[para] Arguments:
# # [list_begin arguments]
# # [arg_def tring p1] A description of string argument p1.
# # [arg_def integer n] A description of integer argument n.
# # [list_end]
# return "ok"
#}
proc info_from_filename {fname} {
#string based filename processing: we are deliberately avoiding test of file existence etc here
if {$fname eq ""} {
@ -137,7 +129,12 @@ tcl::namespace::eval poshinfo {
}
set ftail [file tail $fname]
set rootname [file rootname $ftail]
set format [string trimleft [file extension $ftail] .]
set extension [string trimleft [file extension $ftail] .]
if {$extension eq "yml"} {
set format "yaml"
} else {
set format $extension
}
set parts [split $rootname .]
if {[lindex $parts end] eq "omp"} {
set type omp
@ -146,54 +143,122 @@ tcl::namespace::eval poshinfo {
if {$rootname eq "schema"} {
set type schema
} else {
#review - we can't tell diff betw <themename_with_dots>.<format> and <themename>.<unknowntype>.<format>
set type unknown
}
set shortname $rootname
}
return [dict create shortname $shortname format $format type $type]
return [dict create shortname $shortname format $format extension $extension type $type]
}
proc themes_dict {{globfor *}} {
#restrict glob to filename in filename.<type>.<format>
proc Themes_dict {{globlist *}} {
set running_config [punk::config::get running-config]
set posh_themes_path [tcl::dict::get $running_config posh_themes_path]
#posh_themes_path_extra ??
set themes [tcl::dict::create]
set themes_dict [tcl::dict::create]
if {[string length $posh_themes_path]} {
if {[file exists $posh_themes_path]} {
set files [glob -nocomplain -directory $posh_themes_path -tails $globfor]
set files [glob -nocomplain -directory $posh_themes_path -tails -- {*}$globlist]
foreach ftail $files {
set themeinfo [info_from_filename $ftail]
set shortname [dict get $themeinfo shortname]
set name_matched 0
foreach glob $globlist {
if {[string match -nocase $glob $shortname]} {
set name_matched 1
break
}
}
if {$name_matched} {
dict set themeinfo path [file join $posh_themes_path $ftail]
if {![dict exists $themes $shortname]} {
dict set themes $shortname [list $themeinfo]
if {![dict exists $themes_dict $shortname]} {
dict set themes_dict $shortname [list $themeinfo]
} else {
dict lappend themes $shortname $themeinfo
dict lappend themes_dict $shortname $themeinfo
}
}
}
}
}
return $themes_dict
}
proc get_active_theme {} {
lassign [punk::config::get running posh_theme] _ themepath
set theme_info [info_from_filename $themepath]
dict set theme_info path $themepath
}
proc set_active_theme_by_name {name} {
error "unimplemented"
}
proc set_active_theme_by_path {path} {
error "unimplemented"
}
proc themes {args} {
set argd [punk::args::get_dict {
*id poshinfo::themes
*proc -name poshinfo::themes
-format -default all -multiple 1 -choices {all yaml json}\
-help "File format of posh theme - based on file extension"
-type -default all -multiple 1\
-help "e.g omp"
-as -default "table" -choices {list showlist dict showdict table tableobject plaintext}\
-help "return type of result"
*values -min 0
globs -multiple 1 -default * -help ""
} $args]
set return_as [dict get $argd opts -as]
set formats [dict get $argd opts -format] ;#multiple
if {"yaml" in $formats} {
lappend formats "yml" ;#unpreferred extension for yaml - but accepted
}
return $themes
set types [dict get $argd opts -type] ;#multiple
set globlist [dict get $argd values globs]
set themes_dict [Themes_dict $globlist]
set restricted_themes_dict [dict create]
dict for {shortname themeinfolist} $themes_dict {
set themeinfo [lindex $themeinfolist 0]
if {("all" in $formats || [dict get $themeinfo format] in $formats) && ("all" in $types || [dict get $themeinfo type] in $types)} {
dict set restricted_themes_dict $shortname $themeinfolist
}
}
unset themes_dict
switch -- $return_as {
dict {
return $restricted_themes_dict
}
showdict {
return [showdict $restricted_themes_dict */@*/@*.@*]
}
proc themes {{globfor *}} {
set themes [themes_dict $globfor]
list {
return [dict keys $restricted_themes_dict]
}
showlist {
return [showlist [dict keys $restricted_themes_dict]]
}
}
set posh_theme [file normalize [punk::config::get_running_global posh_theme]]
set t [textblock::class::table new "Posh Themes"]
$t configure -show_header 1 -show_hseps 0
$t add_column -headers Shortname
$t add_column -headers Path
dict for {shortname themeinfolist} $themes {
dict for {shortname themeinfolist} $restricted_themes_dict {
#hack - support just one for now
set themeinfo [lindex $themeinfolist 0]
set path [dict get $themeinfo path]
$t add_row [list $shortname $path]
set fg ""
set bg ""
switch -- [dict get $themeinfo type] {
schema {
set fg black
set bg Web-orange
}
omp {}
@ -212,9 +277,22 @@ tcl::namespace::eval poshinfo {
$t configure_row [expr {[$t row_count]-1}] -ansibase [a+ {*}$fg {*}$bg]
}
}
set result [$t print]
switch -- $return_as {
plaintext {
$t configure -frametype {}
set tabletext [$t print]
set pt [punk::ansi::ansistrip $tabletext]
return [join [lines_as_list -line trimline $pt] \n]
}
table {
set tabletext [$t print]
$t destroy
return $result
return $tabletext
}
tableobject {
return $t
}
}
}
@ -230,6 +308,7 @@ tcl::namespace::eval poshinfo {
tcl::namespace::eval poshinfo::lib {
tcl::namespace::export {[a-z]*} ;# Convention: export all lowercase
tcl::namespace::path [tcl::namespace::parent]
#*** !doctools
#[subsection {Namespace poshinfo::lib}]
#[para] Secondary functions that are part of the API
@ -254,7 +333,9 @@ tcl::namespace::eval poshinfo::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
#tcl::namespace::eval poshinfo::system {
#*** !doctools
#[subsection {Namespace poshinfo::system}]
#[para] Internal functions that are not part of the API

23
src/vfs/_vfscommon.vfs/modules/punk-0.1.tm

@ -7326,21 +7326,28 @@ namespace eval punk {
if {$topic in [list tcl]} {
if {[punk::lib::system::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::system::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
if {[punk::lib::check::has_tclbug_script_var]} {
append warningblock \n "minor warning: punk::lib::check::has_tclbug_script_var returned true! (string rep for list variable in script generated when script changed)"
}
if {[punk::lib::system::has_tclbug_safeinterp_compile]} {
if {[punk::lib::check::has_tclbug_safeinterp_compile]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_safeinterp returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_safeinterp returned true!" \n
append warningblock "${indent}(ensemble commands not compiled in safe interps - heavy performance impact in safe interps)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/1095bf7f75"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/1095bf7f75]"
append warningblock [a]
}
if {[punk::lib::system::has_tclbug_list_quoting_emptyjoin]} {
if {[punk::lib::check::has_tclbug_lsearch_strideallinline]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::system::has_tclbug_list_quoting returned true!" \n
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_lsearch_strideallinline returned true!" \n
append warningblock "${indent}(lsearch using -stride -all -inline -subindices does not return values corresponding to subindex when a single -index value is used)" \n
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/5a1aaa201d]"
append warningblock [a]
}
if {[punk::lib::check::has_tclbug_list_quoting_emptyjoin]} {
set indent " "
append warningblock \n "[a+ web-red]warning: punk::lib::check::has_tclbug_list_quoting returned true!" \n
append warningblock "${indent}lists elements not properly quoted in some cases. e.g 'list {*}[lindex {etc #foo} 1] {*}[list]' (#foo not braced)" \n
append warningblock "${indent}see https://core.tcl-lang.org/tcl/tktview/e38dce74e2"
append warningblock "${indent}see [punk::ansi::hyperlink https://core.tcl-lang.org/tcl/tktview/e38dce74e2]"
}
}

10
src/vfs/_vfscommon.vfs/modules/punk/aliascore-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::aliascore 0 0.1.0]
#[manpage_begin punkshell_module_punk::aliascore 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[titledesc {punkshell command aliases}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::aliascore]
#[keywords module]
#[keywords module alias]
#[description]
#[para] -

150
src/vfs/_vfscommon.vfs/modules/punk/ansi-0.1.1.tm

@ -417,8 +417,11 @@ tcl::namespace::eval punk::ansi {
convert*\
clear*\
cursor_*\
delete*\
detect*\
erase*\
get_*\
hyperlink\
move*\
reset*\
ansistrip*\
@ -618,7 +621,7 @@ tcl::namespace::eval punk::ansi {
set subtitle [tcl::dict::get $picinfo status]
}
set title [tcl::dict::get $picinfo filename]
set fr [textblock::frame -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
set fr [textblock::frame -checkargs 0 -width $colwidth -subtitle $subtitle -title $title [tcl::dict::get $picinfo pic]]
# -- --- --- ---
#we need the max height of a row element to use join_basic instead of join below
# -- --- --- ---
@ -3096,6 +3099,18 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
return "\033\[?25l"
}
# REVIEW - osc8 replays etc for split lines? - textblock
#the 'id' parameter logically connects split hyperlinks
proc hyperlink {uri {display ""}} {
if {$display eq ""} {
set display $uri
}
set params "" ;#todo e.g id=xyz123:foo=bar:baz=quux
set open "\x1b\]8\;$params\;$uri\x1b\\"
set close "\x1b\]8\;\;\x1b\\"
return ${open}${display}${close}
}
# -- --- --- --- ---
proc move {row col} {
#*** !doctools
@ -3634,11 +3649,27 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
}
set parts [punk::ansi::ta::split_codes $text]
set out ""
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
foreach {pt code} $parts {
append out $pt
}
return $out
}
proc ansistrip2 {text} {
#*** !doctools
#[call [fun ansistrip] [arg text] ]
#[para]Return a string with ansi codes stripped out
#[para]Alternate graphics chars are replaced with modern unicode equivalents (e.g boxdrawing glyphs)
if {[punk::ansi::ta::detect_g0 $text]} {
set text [convert_g0 $text];#Convert ansi borders to unicode line drawing instead of ascii letters
}
set parts [punk::ansi::ta::split_codes $text]
#todo - try: join [lsearch -stride 2 -index 0 -subindices -all -inline $parts *] ""
# - (if/when lsearch -stride bug fixed)
join [lmap v [lseq 0 to [llength $parts] by 2] {lindex $parts $v}] "" ;#slightly slower than above foreach
}
#interp alias {} stripansi {} ::punk::ansi::ansistrip
proc ansistripraw {text} {
#*** !doctools
@ -3842,8 +3873,9 @@ tcl::namespace::eval punk::ansi {
proc sgr_merge {codelist args} {
set allparts [list]
foreach c $codelist {
set cparts [punk::ansi::ta::split_codes_single $c]
lappend allparts {*}[lsearch -all -inline -not $cparts ""]
#set cparts [punk::ansi::ta::split_codes_single $c]
#lappend allparts {*}[lsearch -all -inline -not $cparts ""]
lappend allparts {*}[punk::ansi::ta::get_codes_single $c]
}
sgr_merge_singles $allparts {*}$args
}
@ -4362,10 +4394,12 @@ tcl::namespace::eval punk::ansi::ta {
# -- --- --- ---
variable re_ansi_detect1 "${re_csi_code}|${re_esc_osc1}|${re_esc_osc2}|${re_esc_osc3}|${re_standalones}|${re_ST}|${re_g0_open}|${re_g0_close}"
# -- --- --- ---
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regext TRIE generator that works with Tcl regexes
#handrafted TRIE version of above. Somewhat difficult to construct and maintain. TODO - find a regexp TRIE generator that works with Tcl regexes
#This does make things quicker - but it's too early to finalise the detect/split regexes (e.g missing \U0090 ) - will need to be redone.
variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#variable re_ansi_detect {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
variable re_ansi_detect {(?:\x1b(?:\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\((?:0|B)|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
# -- --- --- ---
#variable re_csi_code {(?:\x1b\[|\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]}
@ -4389,9 +4423,7 @@ tcl::namespace::eval punk::ansi::ta {
#can be used on dicts - but will check keys too. keys could also contain ansi and have escapes
proc detect_in_list {list} {
detect [join $list " "]
}
proc detect_in_list2 {list} {
#loop is commonly faster than using join. (certain ansi codes triggering list quoting? review)
foreach item $list {
if {[detect $item]} {
return 1
@ -4399,6 +4431,11 @@ tcl::namespace::eval punk::ansi::ta {
}
return 0
}
#surprisingly - the ::join operation can be (relatively) slow on lists containing ansi
proc detect_in_list2 {list} {
detect [join $list " "]
}
proc detect_g0 {text} [string map [list <re> [list $re_g0_group]] {
regexp <re> $text
}]
@ -4580,13 +4617,108 @@ tcl::namespace::eval punk::ansi::ta {
#like split_codes - but each ansi-escape is split out separately (with empty string of plaintext between codes so odd/even plain ansi still holds)
#- the slightly simpler regex than split_codes means that it will be slightly faster than keeping the codes grouped.
proc split_codes_single {text} {
proc split_codes_single2 {text} {
variable re_ansi_split
return [_perlish_split $re_ansi_split $text]
}
proc split_codes_single3 {text} {
#copy from re_ansi_split
_perlish_split {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text
}
proc split_codes_single4 {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set re $re_ansi_split
#variable re_ansi_detect1
#set re $re_ansi_detect1
set list [list]
set start 0
#set re {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c}
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
#while {[regexp -start $start -indices -- {(?:\x1b(?:\((?:0|B)|\[(?:[\x20-\x2f\x30-\x3f]*[\x40-\x7e])|\](?:(?:[^\007]*)\007|(?:(?!\x1b\\).)*\x1b\\)|(?:P|X|\^|_)(?:(?:(?!\x1b\\|\007).)*(?:\x1b\\|\007))|c|7|8|M|E|D|H|=|>|(?:#(?:3|4|5|6|8))))|(?:\u0090|\u0098|\u009E|\u009F)(?:(?!\u009c).)*(?:\u009c)|(?:\u009b)[\x20-\x2f\x30-\x3f]*[\x40-\x7e]|(?:\u009d)(?:[^\u009c]*)?\u009c} $text match]} {}
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
lappend list [tcl::string::range $text $start $matchStart-1]
if {$matchEnd < $matchStart} {
set e $matchStart
incr start
} else {
set e $matchEnd
set start [expr {$matchEnd+1}]
}
lappend list [tcl::string::range $text $matchStart $e]
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc split_codes_single {text} {
if {$text eq ""} {
return {}
}
variable re_ansi_split
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re_ansi_split $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc get_codes_single {text} {
variable re_ansi_split
regexp -all -inline -- $re_ansi_split $text
}
#review - tcl greedy expressions may match multiple in one element
proc _perlish_split {re text} {
if {$text eq ""} {
return {}
}
set next 0
set b -1
set list [list]
set coderanges [regexp -indices -all -inline -- $re $text]
foreach cr $coderanges {
lappend list [tcl::string::range $text $next [lindex $cr 0]-1] [tcl::string::range $text [lindex $cr 0] [lindex $cr 1]]
set next [expr {[lindex $cr 1]+1}]
}
lappend list [tcl::string::range $text $next end]
return $list
}
proc _perlish_split2 {re text} {
if {$text eq ""} {
return {}
}
set list [list]
set start 0
#We can get $matchEnd < $matchStart; we need to ensure there is an exit condition for non-greedy empty results REVIEW
while {[regexp -start $start -indices -- $re $text match]} {
lassign $match matchStart matchEnd
#puts "->start $start ->match $matchStart $matchEnd"
if {$matchEnd < $matchStart} {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchStart]
incr start
} else {
lappend list [tcl::string::range $text $start $matchStart-1] [tcl::string::range $text $matchStart $matchEnd]
set start [expr {$matchEnd+1}]
}
if {$start >= [tcl::string::length $text]} {
break
}
}
return [lappend list [tcl::string::range $text $start end]]
}
proc _perlish_split3 {re text} {
if {$text eq ""} {
return {}
}

721
src/vfs/_vfscommon.vfs/modules/punk/args-0.1.0.tm

File diff suppressed because it is too large Load Diff

6
src/vfs/_vfscommon.vfs/modules/punk/assertion-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::assertion 0 0.1.0]
#[manpage_begin punkshell_module_punk::assertion 0 0.1.0]
#[copyright "2024"]
#[titledesc {assertion alternative to control::assert}] [comment {-- Name section and table of contents description --}]
#[moddesc {per-namespace assertions with }] [comment {-- Description at end of page heading --}]

10
src/vfs/_vfscommon.vfs/modules/punk/basictelnet-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::basictelnet 0 0.1.0]
#[manpage_begin punkshell::basictelnet 0 0.1.0]
#[copyright "2024"]
#[titledesc {basic telnet client - DKF/Wiki}] [comment {-- Name section and table of contents description --}]
#[moddesc {basic telnet client}] [comment {-- Description at end of page heading --}]
#[require punk::basictelnet]
#[keywords module]
#[keywords module telnet protocol console terminal]
#[description]
#[para] see https://wiki.tcl-lang.org/page/Tcl+Telnet
@ -407,7 +407,7 @@ namespace eval punk::basictelnet {
set RST "\x1b\[m"
set debug_width 80
set infoframe [textblock::frame -width $debug_width -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug $terminal_type (encoding guess:$encoding_guess)$RST" $info]
set infoframe [textblock::frame -checkargs 0 -width $debug_width -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug $terminal_type (encoding guess:$encoding_guess)$RST" $info]
#set w [textblock::width $infoframe]
set spacepatch "$RST[textblock::block $debug_width 4 { }]"
#puts -nonewline [punk::ansi::cursor_off]

10
src/vfs/_vfscommon.vfs/modules/punk/blockletter-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::blockletter 0 0.1.0]
#[manpage_begin punkshell_module_punk::blockletter 0 0.1.0]
#[copyright "2024"]
#[titledesc {punk::blockletter frame-based large lettering test/logo}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
@ -299,10 +299,10 @@ tcl::namespace::eval punk::blockletter::lib {
set h_in [expr {$h -2}]
if {$w_in > 0 && $h_in > 0} {
set inner [textblock::block $w_in $h_in \u00a0] ;#NBSP
textblock::frame -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg] $inner
textblock::frame -checkargs 0 -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg] $inner
} else {
#important to use no content arg - as empty string has 'height' of 1 in the textblock context (min height of any string is 1 row in the console)
textblock::frame -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg]
textblock::frame -checkargs 0 -type $f -height $h -width $w -ansiborder [a+ $bd $bg] -ansibase [a+ $bg]
}
}

6
src/vfs/_vfscommon.vfs/modules/punk/cesu-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -19,7 +19,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::cesu 0 0.1.0]
#[manpage_begin punkshell_module_punk::cesu 0 0.1.0]
#[copyright "2024"]
#[titledesc {CESU compatibility ehcoding scheme for utf-16: 8-Bit (CESU-8) ??}] [comment {-- Name section and table of contents description --}]
#[moddesc {CESU experimental}] [comment {-- Description at end of page heading --}]

8
src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm

@ -593,7 +593,13 @@ namespace eval punk::console {
if {!$::punk::console::ansi_available} {
return ""
}
set callid [info cmdcount] ;#info cmdcount is almost as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
# -- ---
#set callid [info cmdcount] ;#info cmdcount is fast, though not as fast as clock clicks - and whilst not unique in a long-running app(will wrap?) - fine for this context
#clock clicks is approx 2x faster - but can sometimes give duplicates if called sequentially e.g list [clock clicks] [clock clicks]
#Either is suitable here, where subsequent calls will be relatively far apart in time
#speed of call insignificant compared to function
set callid [clock clicks]
# -- ---
#
upvar ::punk::console::ansi_response_chunk accumulator

1
src/vfs/_vfscommon.vfs/modules/punk/docgen-0.1.0.tm

@ -31,6 +31,7 @@ namespace eval punk::docgen {
error "get_doctools_comments file '$fname' not found"
}
set fd [open $fname r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {![string match "*#\**!doctools*" $data]} {

6
src/vfs/_vfscommon.vfs/modules/punk/experiment-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::experiment 0 0.1.0]
#[manpage_begin punkshell_module_punk::experiment 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]

6
src/vfs/_vfscommon.vfs/modules/punk/island-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -32,7 +32,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::island 0 0.1.0]
#[manpage_begin punkshell_module_punk::island 0 0.1.0]
#[copyright "2024"]
#[titledesc {filesystem islands for safe interps}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::island for safe interps}] [comment {-- Description at end of page heading --}]

932
src/vfs/_vfscommon.vfs/modules/punk/lib-0.1.1.tm

File diff suppressed because it is too large Load Diff

6
src/vfs/_vfscommon.vfs/modules/punk/mix/commandset/doc-0.1.0.tm

@ -48,6 +48,7 @@ namespace eval punk::mix::commandset::doc {
set oldfiles [punk::path::treefilenames -dir $projectdir/src/doc _module_*.man]
foreach maybedoomed $oldfiles {
set fd [open $maybedoomed r]
chan conf $fd -translation binary
set data [read $fd]
close $fd
if {[string match "*--- punk::docgen overwrites *" $data]} {
@ -170,7 +171,7 @@ namespace eval punk::mix::commandset::doc {
-- -type none -optional 1 -help "end of options marker --"
-individual -type boolean -default 1
*values -min 0 -max -1
patterns -default {*} -type any -multiple 1
patterns -default {*.man} -type any -multiple 1
} $args]
set opt_individual [tcl::dict::get $argd opts -individual]
set patterns [tcl::dict::get $argd values patterns]
@ -190,7 +191,7 @@ namespace eval punk::mix::commandset::doc {
set docroot $projectdir/src/doc
cd $docroot
if {!$opt_individual && "*" in $patterns} {
if {!$opt_individual && "*.man" in $patterns} {
if {[catch {
dtplite validate $docroot
} errM]} {
@ -251,6 +252,7 @@ namespace eval punk::mix::commandset::doc {
append docgen_header_comments {[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}]} \n
append docgen_header_comments {[comment {--- punk::docgen overwrites this file ---}]} \n
foreach fullpath $matched_paths {
puts stdout "do_docgen processing: $fullpath"
set doctools [punk::docgen::get_doctools_comments $fullpath]
if {$doctools ne ""} {
set fname [file tail $fullpath]

96
src/vfs/_vfscommon.vfs/modules/punk/mix/commandset/scriptwrap-0.1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'dev make' or src/make.tcl to update from <pkg>-buildversion.txt
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -13,19 +13,70 @@
# @@ Meta End
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin punkshell_module_scriptwrap 0 0.1.0]
#[copyright "2024"]
#[titledesc {scriptwrap polyglot tool}] [comment {-- Name section and table of contents description --}]
#[moddesc {scriptwrap tool}] [comment {-- Description at end of page heading --}]
#[require punk::mix::commandset::scriptwrap]
#[keywords module commandset launcher scriptwrap]
#[description]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Overview]
#[para] overview of scriptwrap
#[subsection Concepts]
#[para] -
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[subsection dependencies]
#[para] packages used by poshinfo
#[list_begin itemized]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
##e.g package require frobz
package require punk::lib
package require punk::args
package require punk::mix
package require punk::mix::base
package require punk::fileline
#*** !doctools
#[item] [package {Tcl 8.6}]
#[item] [package {punk::lib}]
#[item] [package {punk::args}]
#[item] [package {punk::mix}]
#[item] [package {punk::base}]
#[item] [package {punk::fileline}]
#*** !doctools
#[list_end]
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
namespace eval punk::mix::commandset::scriptwrap {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap}]
#[para] Core API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
namespace export *
namespace eval fileline {
@ -1192,22 +1243,33 @@ namespace eval punk::mix::commandset::scriptwrap {
return $result
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap ---}]
namespace eval lib {
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::lib}]
#[para] Library API functions for punk::mix::commandset::scriptwrap
#[list_begin definitions]
proc get_wrapper_folders {args} {
set argd [punk::args::get_dict {
#*** !doctools
#[call [fun get_wrapper_folders] [arg args] ]
#[para] Return list of dicts representing wrapper folders. keys: basefolder sourceinfo
#[para] Return list of dicts representing wrapper folders in the project. keys: basefolder sourceinfo
#[para] Arguments:
# [list_begin arguments]
# [arg_def string args] name-value pairs -scriptpath <path>
# [list_end]
*proc -name get_wrapper_folders
*id punk::mix::commandset::scriptwrap
*proc -name punk::mix::commandset::get_wrapper_folders
*opts -anyopts 0
-scriptpath -default ""
-scriptpath -default "" -type directory\
-help ""
#todo -help folder within a punk.templates provided area???
*values -minvalues 0 -maxvalues 0
} $args]
@ -1377,11 +1439,16 @@ namespace eval punk::mix::commandset::scriptwrap {
return [dict create ok $status linecount [llength $lines] data $tags errors $errors]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::lib ---}]
}
namespace eval batchlib {
#
#*** !doctools
#[subsection {Namespace punk::mix::commandset::scriptwrap::batchlib}]
#[para] Utility funcions for processing windows .bat files
#[list_begin definitions]
#see also: https://www.dostips.com/forum/viewtopic.php?t=3803 'Rules for label names vs GOTO and CALL
# review - we may need different get_callsite_label functions?
@ -1647,23 +1714,13 @@ namespace eval punk::mix::commandset::scriptwrap {
#return rawlabel so we can see it as it appears in the data - as opposed to how it is interpreted as a label by cmd.exe
return [list labelfound 1 label $label rawlabel $rawlabel]
}
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::mix::commandset::scriptwrap::batchlib ---}]
}
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::commandset::scriptwrap {
@ -1671,3 +1728,6 @@ package provide punk::mix::commandset::scriptwrap [namespace eval punk::mix::com
set version 0.1.0
}]
return
#*** !doctools
#[manpage_end]

14
src/vfs/_vfscommon.vfs/modules/punk/nav/fs-0.1.0.tm

@ -20,10 +20,10 @@
#*** !doctools
#[manpage_begin shellspy_module_punk::nav::fs 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punk::nav::fs console filesystem navigation}] [comment {-- Name section and table of contents description --}]
#[moddesc {fs nav}] [comment {-- Description at end of page heading --}]
#[require punk::nav::fs]
#[keywords module]
#[keywords module filesystem terminal]
#[description]
#[para] -
@ -936,7 +936,7 @@ tcl::namespace::eval punk::nav::fs {
#windows doesn't consider dotfiles as hidden - mac does (?)
#we add dotfiles to flaggedhidden list in case there is some other mechanism that has flagged items as hidden
if {$::tcl_platform(platform) ne "windows"} {
lappend flaggedhidden {*}[lsearch -all -inline [concat $dirs $files] ".*"]
lappend flaggedhidden {*}[lsearch -all -inline [list {*}$dirs {*}$files] ".*"]
#e.g we can have dupes in the case where there are vfs mounted files that appear as dirs
#as we will need to do a (nat)sort as a last step - it will be faster to not sort items prematurely
#set flaggedhidden [lsort -unique $flaggedhidden]
@ -977,7 +977,8 @@ tcl::namespace::eval punk::nav::fs {
# -- ---
foreach nm [concat $dirs $files] {
#jmn
foreach nm [list {*}$dirs {*}$files] {
if {[punk::winpath::illegalname_test $nm]} {
lappend nonportable $nm
}
@ -1272,7 +1273,8 @@ tcl::namespace::eval punk::nav::fs {
#set widest1 [punk::pipedata [list {*}$dirs ""] {lmap v $data {string length $v}} {tcl::mathfunc::max {*}$data}]
set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
#set widest1 [tcl::mathfunc::max {*}[lmap v [concat $dirs [list ""]] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list {*}$dirs ""] {string length $v}]]
set displaylist [list]
set col1 [string repeat " " [expr {$widest1 + 2}]]

7
src/vfs/_vfscommon.vfs/modules/punk/ns-0.1.0.tm

@ -755,7 +755,9 @@ tcl::namespace::eval punk::ns {
set seencmds [list]
set masked [list] ;#
set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
#jmn
#set cmdsets [concat $procs $ensembles $ooclasses $ooobjects $ooprivateobjects $ooprivateclasses $native $interps $coroutines $zlibstreams]
set cmdsets [list {*}$procs {*}$ensembles {*}$ooclasses {*}$ooobjects {*}$ooprivateobjects {*}$ooprivateclasses {*}$native {*}$interps {*}$coroutines {*}$zlibstreams]
foreach a $aliases {
if {[list c $a] in $elements} {
#possibly an ordinary alias - or a renamed alias that is masked by a proc/ensemble/oo
@ -1691,7 +1693,8 @@ tcl::namespace::eval punk::ns {
proc _pkguse_vars {varnames} {
while {"pkguse_vars_[incr n]" in $varnames} {}
return [concat $varnames pkguse_vars_$n]
#return [concat $varnames pkguse_vars_$n]
return [list {*}$varnames pkguse_vars_$n]
}
proc tracehandler_nowrite {args} {
error "readonly in use block"

10
src/vfs/_vfscommon.vfs/modules/punk/packagepreference-0.1.0.tm

@ -1,5 +1,5 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::packagepreference 0 0.1.0]
#[manpage_begin punkshell_module_punk::packagepreference 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[titledesc {punkshell package/module loading}] [comment {-- Name section and table of contents description --}]
#[moddesc {package/module load}] [comment {-- Description at end of page heading --}]
#[require punk::packagepreference]
#[keywords module]
#[keywords module package]
#[description]
#[para] -

20
src/vfs/_vfscommon.vfs/modules/punk/repl-0.1.tm

@ -898,7 +898,7 @@ namespace eval punk::repl::class {
append debug \n $mergedinfo
append debug \n "input:[ansistring VIEW -lf 1 -vt 1 $new0] before row:$o_cursor_row after row: $result_row before col:$o_cursor_col after col:$result_col"
package require textblock
set debug [textblock::frame -buildcache 0 $debug]
set debug [textblock::frame -checkargs 0 -buildcache 0 $debug]
catch {punk::console::move_emitblock_return $debug_first_row 1 $debug}
# -- --- --- --- --- ---
@ -962,7 +962,7 @@ namespace eval punk::repl::class {
set debug "add_chunk$i"
append debug \n $mergedinfo
append debug \n "input:[ansistring VIEW -lf 1 -vt 1 $p]"
set debug [textblock::frame -buildcache 0 $debug]
set debug [textblock::frame -checkargs 0 -buildcache 0 $debug]
#catch {punk::console::move_emitblock_return [expr {$debug_first_row + ($i * 6)}] 1 $debug}
set result [dict get $mergedinfo result]
@ -1033,7 +1033,9 @@ namespace eval punk::repl::class {
#todo
#each newpart needs its grapheme split info to be stored
set o_rendered_lines [concat $o_rendered_lines [lrange $newparts 1 end]]
#jmn
#set o_rendered_lines [concat $o_rendered_lines [lrange $newparts 1 end]]
lappend o_rendered_lines {*}[lrange $newparts 1 end]
}
method linecount {} {
@ -1565,11 +1567,11 @@ proc punk::repl::console_debugview {editbuf consolewidth args} {
}
set debug_height [expr {[llength $lines]+2}] ;#framed height
} errM]} {
set info [textblock::frame -buildcache 0 -title "[a red]error$RST" $errM]
set info [textblock::frame -checkargs 0 -buildcache 0 -title "[a red]error$RST" $errM]
set debug_height [textblock::height $info]
} else {
#treat as ephemeral (unreusable) frames due to varying width & height - therefore set -buildcache 0
set info [textblock::frame -buildcache 0 -ansiborder [a+ bold green] -title "[a cyan]debugview_raw$RST" $info]
set info [textblock::frame -checkargs 0 -buildcache 0 -ansiborder [a+ bold green] -title "[a cyan]debugview_raw$RST" $info]
}
set debug_width [textblock::widthtopline $info]
@ -1604,14 +1606,14 @@ proc punk::repl::console_editbufview {editbuf consolewidth args} {
set info [punk::lib::list_as_lines $lines]
}
} editbuf_error]} {
set info [textblock::frame -buildcache 0 -title "[a red]error[a]" "$editbuf_error\n$::errorInfo"]
set info [textblock::frame -checkargs 0 -buildcache 0 -title "[a red]error[a]" "$editbuf_error\n$::errorInfo"]
} else {
set title "[a cyan]editbuf [expr {[llength $editbuf_list]-1}] lines [$editbuf linecount][a]"
append title "[a+ yellow bold] col:[format %3s [$editbuf cursor_column]] row:[$editbuf cursor_row][a]"
set row1 " lastchar:[ansistring VIEW -lf 1 [$editbuf last_char]] lastgrapheme:[ansistring VIEW -lf 1 [$editbuf last_grapheme]]"
set row2 " lastansi:[ansistring VIEW -lf 1 [$editbuf last_ansi]]"
set info [a+ green bold]$row1\n$row2[a]\n$info
set info [textblock::frame -buildcache 0 -ansiborder [a+ green bold] -title $title $info]
set info [textblock::frame -checkargs 0 -buildcache 0 -ansiborder [a+ green bold] -title $title $info]
}
set editbuf_width [textblock::widthtopline $info]
set spacepatch [textblock::block $editbuf_width 2 " "]
@ -1635,7 +1637,7 @@ proc punk::repl::console_controlnotification {message consolewidth consoleheight
set message [lindex $messagelines 0] ;#only allow single line
set info "[a+ bold red]$message[a]"
set hlt [dict get [textblock::framedef light] hlt]
set box [textblock::frame -boxmap [list tlc $hlt trc $hlt] -title $message -height 1]
set box [textblock::frame -checkargs 0 -boxmap [list tlc $hlt trc $hlt] -title $message -height 1]
set notification_width [textblock::widthtopline $info]
set box_offset [expr {$consolewidth - $notification_width - $opt_rightmargin}]
set row [expr {$consoleheight - $opt_bottommargin}]
@ -2155,7 +2157,7 @@ proc repl::repl_process_data {inputchan chunktype chunk stdinlines prompt_config
#-----------------------------------------
#list/string-rep bug workaround part 2
#todo - set flag based on punk::lib::system::has_tclbug_script_var
#todo - set flag based on punk::lib::check::has_tclbug_script_var
lappend run_command_cache $run_command_string
#puts stderr "run_command_string rep: [rep $run_command_string]"
if {[llength $run_command_cache] > 2000} {

2
src/vfs/_vfscommon.vfs/modules/punk/repo-0.1.1.tm

@ -710,7 +710,7 @@ namespace eval punk::repo {
lappend col2_values [dict get $summary_dict $f]
}
set title1 ""
set widest1 [tcl::mathfunc::max {*}[lmap v [concat [list $title1] $col1_fields] {string length $v}]]
set widest1 [tcl::mathfunc::max {*}[lmap v [list $title1 {*}$col1_fields] {string length $v}]]
set col1 [string repeat " " $widest1]
set title2 ""
set widest2 [tcl::mathfunc::max {*}[lmap v [concat [list $title2] $col2_values] {string length $v}]]

6
src/vfs/_vfscommon.vfs/modules/punk/rest-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -19,7 +19,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::rest 0 0.1.0]
#[manpage_begin punkshell_module_punk::rest 0 0.1.0]
#[copyright "2024"]
#[titledesc {punk::rest}] [comment {-- Name section and table of contents description --}]
#[moddesc {experimental rest}] [comment {-- Description at end of page heading --}]

6
src/vfs/_vfscommon.vfs/modules/punk/sshrun-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) 2009 Jose F. Nieves
@ -30,7 +30,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::sshrun 0 0.1.0]
#[manpage_begin punkshell_module_punk::sshrun 0 0.1.0]
#[copyright "2009"]
#[titledesc {Tcl procedures to execute tcl scripts in remote hosts}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::sshrun tclssh clone}] [comment {-- Description at end of page heading --}]

85
src/vfs/_vfscommon.vfs/modules/punk/trie-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::trie 0 0.1.0]
#[manpage_begin punkshell_module_punk::trie 0 0.1.0]
#[copyright "2010"]
#[titledesc {punk::trie API}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::trie}] [comment {-- Description at end of page heading --}]
@ -64,34 +64,34 @@ package require Tcl 8.6-
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::trie::class {
#*** !doctools
#[subsection {Namespace punk::trie::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #tcl::namespace::eval punk::trie::class {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #[subsection {Namespace punk::trie::class}]
# #[para] class definitions
# #if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #[list_begin enumerated]
#
# # oo::class create interface_sample1 {
# # #*** !doctools
# # #[enum] CLASS [class interface_sample1]
# # #[list_begin definitions]
#
# # method test {arg1} {
# # #*** !doctools
# # #[call class::interface_sample1 [method test] [arg arg1]]
# # #[para] test method
# # puts "test: $arg1"
# # }
#
# # #*** !doctools
# # #[list_end] [comment {-- end definitions interface_sample1}]
# # }
#
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# #[list_end] [comment {--- end class enumeration ---}]
# #}
# #}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
@ -114,11 +114,18 @@ tcl::namespace::eval punk::trie {
}
#namespace path ::punk::trie::log
#[para] class definitions
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
if {[tcl::info::commands [tcl::namespace::current]::trieclass] eq ""} {
#*** !doctools
#[list_begin enumerated]
oo::class create [tcl::namespace::current]::trieclass {
#*** !doctools
#[enum] CLASS [class trieclass]
#[list_begin definitions]
variable trie id
method matches {t what} {
@ -412,9 +419,8 @@ tcl::namespace::eval punk::trie {
}
set acc {}
foreach key [dict keys $t] {
lappend acc {*}[my flatten [dict get $t $key] $prefix$key]
dict for {key val} $t {
lappend acc {*}[my flatten $val $prefix$key]
}
return $acc
}
@ -484,8 +490,14 @@ tcl::namespace::eval punk::trie {
my insert $a
}
}
#*** !doctools
#[list_end] [comment {--- end definitions ---}]
}
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
set testlist [list blah x black blacken]
proc test1 {} {
#JMN
@ -516,14 +528,9 @@ tcl::namespace::eval punk::trie {
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
}
#*** !doctools
#[subsection {Namespace punk::trie}]
#[para] Core API functions for punk::trie
#[list_begin definitions]
@ -542,8 +549,6 @@ tcl::namespace::eval punk::trie {
#*** !doctools
#[list_end] [comment {--- end definitions namespace punk::trie ---}]
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++

10
src/vfs/_vfscommon.vfs/modules/punk/uc-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.2.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,12 +18,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::uc 0 0.1.0]
#[manpage_begin punkshell_module_punk::uc 0 0.1.0]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::uc]
#[keywords module]
#[keywords module unofficial unicode wcswidth]
#[description]
#[para] -
@ -35022,7 +35022,9 @@ namespace eval punk::uc::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
namespace eval punk::uc::system {
#*** !doctools
#[subsection {Namespace punk::uc::system}]
#[para] Internal functions that are not part of the API

8
src/vfs/_vfscommon.vfs/modules/punk/winlnk-0.1.0.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -18,7 +18,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::winlnk 0 0.1.0]
#[manpage_begin punkshell_module_punk::winlnk 0 0.1.0]
#[copyright "2024"]
#[titledesc {windows shortcut .lnk library}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk::winlnk}] [comment {-- Description at end of page heading --}]
@ -34,7 +34,7 @@
#[para] overview of punk::winlnk
#[subsection Concepts]
#[para] Windows shortcuts are a binary format file with a .lnk extension
#[para] Shell Link (.LNK) Binary File Format is documented in [MS_SHLLINK].pdf published by Microsoft.
#[para] Shell Link (.LNK) Binary File Format is documented in [lb]MS_SHLLINK[rb].pdf published by Microsoft.
#[para] Revision 8.0 published 2024-04-23

104
src/vfs/_vfscommon.vfs/modules/punk/zip-0.1.1.tm

@ -1,6 +1,6 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'pmix make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt
# module template: punkshell/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
@ -11,7 +11,7 @@
# @@ Meta Begin
# Application punk::zip 0.1.1
# Meta platform tcl
# Meta license <unspecified>
# Meta license MIT
# @@ Meta End
@ -19,12 +19,12 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin shellspy_module_punk::zip 0 0.1.1]
#[manpage_begin punkshell_module_punk::zip 0 0.1.1]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[require punk::zip]
#[keywords module]
#[keywords module zip fileformat]
#[description]
#[para] -
@ -60,38 +60,6 @@ package require punk::args
#*** !doctools
#[section API]
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# oo::class namespace
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#tcl::namespace::eval punk::zip::class {
#*** !doctools
#[subsection {Namespace punk::zip::class}]
#[para] class definitions
#if {[tcl::info::commands [tcl::namespace::current]::interface_sample1] eq ""} {
#*** !doctools
#[list_begin enumerated]
# oo::class create interface_sample1 {
# #*** !doctools
# #[enum] CLASS [class interface_sample1]
# #[list_begin definitions]
# method test {arg1} {
# #*** !doctools
# #[call class::interface_sample1 [method test] [arg arg1]]
# #[para] test method
# puts "test: $arg1"
# }
# #*** !doctools
# #[list_end] [comment {-- end definitions interface_sample1}]
# }
#*** !doctools
#[list_end] [comment {--- end class enumeration ---}]
#}
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# Base namespace
@ -541,37 +509,60 @@ tcl::namespace::eval punk::zip {
#todo - doctools - [arg ?globs...?] syntax?
#*** !doctools
#[call [fun mkzip] [arg ?options?] [arg filename] ]
#[para] Create a zip archive in 'filename'
#[call [fun mkzip]\
# [opt "[option -offsettype] [arg offsettype]"]\
# [opt "[option -return] [arg returntype]"]\
# [opt "[option -zipkit] [arg 0|1]"]\
# [opt "[option -runtime] [arg preamble_filename]"]\
# [opt "[option -comment] [arg zipfilecomment]"]\
# [opt "[option -directory] [arg dir_to_zip]"]\
# [opt "[option -base] [arg archive_root]"]\
# [opt "[option -exclude] [arg globlist]"]\
# [arg zipfilename]\
# [arg ?glob...?]]
#[para] Create a zip archive in 'zipfilename'
#[para] If a file already exists, an error will be raised.
#[para] Call 'punk::zip::mkzip' with no arguments for usage display.
set argd [punk::args::get_dict {
*proc -name punk::zip::mkzip -help "Create a zip archive in 'filename'"
*proc -name punk::zip::mkzip\
-help "Create a zip archive in 'filename'"
*opts
-offsettype -default "archive" -choices {archive file} -help "zip offsets stored relative to start of entire file or relative to start of zip-archive
-offsettype -default "archive" -choices {archive file}\
-help "zip offsets stored relative to start of entire file or relative to start of zip-archive
Only relevant if the created file has a script/runtime prefix.
"
-return -default "pretty" -choices {pretty list none} -help "mkzip can return a list of the files and folders added to the archive
-return -default "pretty" -choices {pretty list none}\
-help "mkzip can return a list of the files and folders added to the archive
the option -return pretty is the default and uses the punk::lib pdict/plist system
to return a formatted list for the terminal
"
-zipkit -default 0 -type none -help "whether to add mounting script
-zipkit -default 0 -type none\
-help "whether to add mounting script
mutually exclusive with -runtime option
currently vfs::zip based - todo - autodetect zipfs/vfs with pref for zipfs
"
-runtime -default "" -help "specify a prefix file
-runtime -default ""\
-help "specify a prefix file
e.g punk::zip::mkzip -runtime unzipsfx.exe -directory subdir -base subdir output.zip
will create a self-extracting zip archive from the subdir/ folder.
Expects runtime with no existing vfs attached (review)
"
-comment -default "" -help "An optional comment for the archive"
-directory -default "" -help "The new zip archive will scan for contents within this folder or current directory if not provided"
-base -default "" -help "The new zip archive will be rooted in this directory if provided
-comment -default ""\
-help "An optional comment for the archive"
-directory -default ""\
-help "The new zip archive will scan for contents within this folder or current directory if not provided."
-base -default ""\
-help "The new zip archive will be rooted in this directory if provided
it must be a parent of -directory or the same path as -directory"
-exclude -default {CVS/* */CVS/* *~ ".#*" "*/.#*"}
*values -min 1 -max -1
filename -type file -default "" -help "name of zipfile to create"
globs -default {*} -multiple 1 -help "list of glob patterns to match.
Only directories with matching files will be included in the archive"
filename -type file -default ""\
-help "name of zipfile to create"
globs -default {*} -multiple 1\
-help "list of glob patterns to match.
Only directories with matching files will be included in the archive."
} $args]
set filename [dict get $argd values filename]
@ -733,7 +724,7 @@ tcl::namespace::eval punk::zip {
}
set cdoffset [tell $zf]
set endrec [binary format a4ssssiis PK\05\06 0 0 \
$count $count [string length $cd] $cdoffset\
$count $count [string length $cd] [expr {$cdoffset - $dataStartOffset}]\
[string length $opts(-comment)]]
append endrec $opts(-comment)
puts -nonewline $zf $cd
@ -793,17 +784,6 @@ tcl::namespace::eval punk::zip::lib {
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[section Internal]
#tcl::namespace::eval punk::zip::system {
#*** !doctools
#[subsection {Namespace punk::zip::system}]
#[para] Internal functions that are not part of the API
#}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide punk::zip [tcl::namespace::eval punk::zip {

1173
src/vfs/_vfscommon.vfs/modules/textblock-0.1.2.tm

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save