Browse Source
app-punkscript accepts lib:<name> (with or without .tcl - extensionless appends it) as the shell subcommand does: `punkexe script lib:hello` or bare `punkexe lib:hello` via reclassification. The prefix always wins; a literal path beginning lib: (pathological - colon is illegal in Windows filenames) is reachable via ./lib:... Not-found errors list every searched location; only .tcl runs via the script subcommand. Resolution policy is factored into punk::path::scriptlib_resolve (PUNKARGS-documented) rather than copied inline: kit-internal app/scriptlib first and deliberately not externally overridable, then scriptlib dirs relative to the executable - the same policy app-punkshell encodes inline (todo noted: refactor the shell path onto the shared proc). Share definitions via modules, not launcher control flow. Verified on both generations (punk902z, punksys): lib:hello extensionless and explicit, bare-arg reclassification, not-found candidate listing (bin/scriptlib then <root>/scriptlib for a bin/ exe). Project version 0.4.0 (backward-compatible behaviour addition). Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
9 changed files with 286 additions and 11 deletions
@ -1,3 +1,3 @@
|
||||
[project] |
||||
name = "punkshell" |
||||
version = "0.3.1" |
||||
version = "0.4.0" |
||||
|
||||
@ -0,0 +1,38 @@
|
||||
# timer.tcl - Tk countdown timer |
||||
# Usage: timer.tcl <seconds> |
||||
# Creates a Tk window displaying the remaining seconds, counts down to zero, |
||||
# then exits with code 0. |
||||
|
||||
if {[catch {package require tk}]} { |
||||
package require Tk |
||||
} |
||||
|
||||
if {$::argc < 1} { |
||||
puts stderr "Usage: [file tail [info script]] <seconds>" |
||||
exit 1 |
||||
} |
||||
|
||||
set seconds [lindex $::argv 0] |
||||
if {![string is integer -strict $seconds] || $seconds < 0} { |
||||
puts stderr "timer: seconds must be a non-negative integer (got '$seconds')" |
||||
exit 1 |
||||
} |
||||
|
||||
# Track the absolute end time so drift in `after` scheduling does not skew the count. |
||||
set ::timer_end [expr {[clock milliseconds] + $seconds * 1000}] |
||||
|
||||
proc timer_tick {} { |
||||
set remaining [expr {$::timer_end - [clock milliseconds]}] |
||||
if {$remaining <= 0} { |
||||
.clock configure -text 0 |
||||
exit 0 |
||||
} |
||||
.clock configure -text [expr {int(($remaining + 999) / 1000)}] |
||||
after 100 timer_tick |
||||
} |
||||
|
||||
label .clock -text $seconds -font {TkTextFont 48} -padx 40 -pady 30 |
||||
pack .clock -expand 1 -anchor center |
||||
|
||||
wm title . "Timer: $seconds s" |
||||
after 100 timer_tick |
||||
@ -1,6 +1,4 @@
|
||||
0.2.1 |
||||
0.2.2 |
||||
#First line must be a semantic version number |
||||
#all other lines are ignored. |
||||
#0.2.1 - treefilenames: filter '.' and '..' by tail in the hidden-directory glob so recursion does not loop on non-Windows platforms |
||||
#0.2.0 - treefilenames now matches hidden files and recurses into hidden directories on all platforms |
||||
#0.2.0 - added PUNKARGS documentation for punk::path::relative |
||||
#0.2.2 - added scriptlib_resolve: shared resolution policy for the lib:<script> prefix (kit-internal app/scriptlib first and not externally overridable, then scriptlib dirs relative to the executable); PUNKARGS argdoc namespace + registration added to the module |
||||
|
||||
Loading…
Reference in new issue