Browse Source

Build outputs: thin-layout make.tcl sync (G-143 argdoc/help + G-144 synopsis retirement)

punkcheck-managed copies refreshed by 'make.tcl modules' - vendor layouts
basic + project-0.1 and the modpod-shipped template payload, all
byte-identical to src/make.tcl.

Assisted-by: harness=claude; primary-model=claude-opus-5[1m]; api-location=anthropic.com
master
Julian Noble 1 week ago
parent
commit
56a0567a0d
  1. 209
      src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl
  2. 209
      src/project_layouts/vendor/punk/basic/src/make.tcl
  3. 209
      src/project_layouts/vendor/punk/project-0.1/src/make.tcl

209
src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl vendored

@ -2610,13 +2610,18 @@ proc ::punkboot::punkboot_gethelp {args} {
append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n
append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n
append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n
append h " $scriptname tool list|info|build|test ?<toolname> ...? ?-test 0|1?" \n append h " $scriptname tool list ?<toolname> ...?" \n
append h " $scriptname tool info <toolname> ..." \n
append h " $scriptname tool build ?-test 0|1? ?<toolname> ...?" \n
append h " $scriptname tool test ?<toolname> ...?" \n
append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n
append h " test suites, or build (test-gated) and install to <projectdir>/bin" \n append h " test suites, or build (test-gated) and install to <projectdir>/bin; options precede the tool names" \n
append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n
append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n
append h " $scriptname help ?subcommand?" \n append h " $scriptname help ?subcommand? ?action?" \n
append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help)" \n \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help);" \n
append h " with an action word or 0-based form index, that action's single-form usage when the tabled help" \n
append h " is available" \n \n
append h " Flags:" \n append h " Flags:" \n
append h " -confirm 0|1" \n append h " -confirm 0|1" \n
append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n
@ -3234,7 +3239,11 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
help help
" "
Show tabled usage for make.tcl as a whole, or for a single subcommand. Show tabled usage for make.tcl as a whole, or for a single subcommand.
Equivalent to 'make.tcl <subcommand> -help'." Equivalent to 'make.tcl <subcommand> -help'. For the multi-form
subcommands (tool, buildsuite) an action word - or the 0-based form
index the synopsis hints display - narrows to that action's
single-form usage: 'make.tcl help tool build', 'make.tcl help tool 2'
and 'make.tcl tool build -help' all render the build form."
buildsuite buildsuite
" "
Surface for the defined buildsuites under src/buildsuites (zig-built Surface for the defined buildsuites under src/buildsuites (zig-built
@ -3278,16 +3287,19 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
tool info <name> ... tool info <name> ...
Per-tool detail: paths, provenance records, toolchain Per-tool detail: paths, provenance records, toolchain
resolution. resolution.
tool build ?<name> ...? ?-test 0|1? tool build ?-test 0|1? ?<name> ...?
Resolve a zig satisfying the tool's declared floor, run the Resolve a zig satisfying the tool's declared floor, run the
'zig build test' gate (default on; the gate is the EXIT CODE - 'zig build test' gate (default on; the gate is the EXIT CODE -
expected warnings on stderr do not fail it), build ReleaseSafe expected warnings on stderr do not fail it), build ReleaseSafe
and install to <projectdir>/bin. Nothing is installed when the and install to <projectdir>/bin. Nothing is installed when the
gate or the build fails. With no name, all tools are gate or the build fails. Options precede the tool names
(punk::args positional model); with no name, all tools are
processed. processed.
tool test ?<name> ...? tool test ?<name> ...?
Run each tool's 'zig build test' only. Run each tool's 'zig build test' only.
'make.tcl help tool <action>' shows a single action's usage table.
Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder> Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder>
overrides; otherwise <projectdir>/bin/tools/zig* is scanned and overrides; otherwise <projectdir>/bin/tools/zig* is scanned and
the LOWEST release satisfying the floor wins (deterministic as the LOWEST release satisfying the floor wins (deterministic as
@ -3404,7 +3416,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakehouse]}" -& -summary "${[dict get $SUMMARIES bakehouse]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakehouse]}} {${[dict get $HELPTEXTS bakehouse]}}
@form -synopsis "make.tcl bakehouse ?-k? ?-dirty-abort 1|0? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT_ON} ${$OPT_DIRTYABORT_ON}
@ -3417,7 +3428,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES packages]}" -& -summary "${[dict get $SUMMARIES packages]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS packages]}} {${[dict get $HELPTEXTS packages]}}
@form -synopsis "make.tcl packages ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3429,7 +3439,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES modules]}" -& -summary "${[dict get $SUMMARIES modules]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS modules]}} {${[dict get $HELPTEXTS modules]}}
@form -synopsis "make.tcl modules ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3441,7 +3450,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libs]}" -& -summary "${[dict get $SUMMARIES libs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libs]}} {${[dict get $HELPTEXTS libs]}}
@form -synopsis "make.tcl libs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3453,7 +3461,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bake]}" -& -summary "${[dict get $SUMMARIES bake]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bake]}} {${[dict get $HELPTEXTS bake]}}
@form -synopsis "make.tcl bake ?-k? ?-dirty-abort? ?-confirm 0|1? ?kitname ...?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3472,7 +3479,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakelist]}" -& -summary "${[dict get $SUMMARIES bakelist]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakelist]}} {${[dict get $HELPTEXTS bakelist]}}
@form -synopsis "make.tcl bakelist ?kitname ...?"
@values -min 0 -max -1 @values -min 0 -max -1
kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -& kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -&
"Configured kit output(s) to report on - a kit name, or @<groupname> "Configured kit output(s) to report on - a kit name, or @<groupname>
@ -3486,7 +3492,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfslibs]}" -& -summary "${[dict get $SUMMARIES vfslibs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfslibs]}} {${[dict get $HELPTEXTS vfslibs]}}
@form -synopsis "make.tcl vfslibs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3498,7 +3503,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bin]}" -& -summary "${[dict get $SUMMARIES bin]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bin]}} {${[dict get $HELPTEXTS bin]}}
@form -synopsis "make.tcl bin ?-k? ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3511,7 +3515,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vendorupdate]}" -& -summary "${[dict get $SUMMARIES vendorupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vendorupdate]}} {${[dict get $HELPTEXTS vendorupdate]}}
@form -synopsis "make.tcl vendorupdate ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3522,7 +3525,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libfetch]}" -& -summary "${[dict get $SUMMARIES libfetch]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libfetch]}} {${[dict get $HELPTEXTS libfetch]}}
@form -synopsis "make.tcl libfetch ?-serverurl <url>? ?-trust-server? ?-force?"
@opts @opts
${$OPT_SERVERURL} ${$OPT_SERVERURL}
${$OPT_TRUSTSERVER} ${$OPT_TRUSTSERVER}
@ -3535,7 +3537,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bootsupport]}" -& -summary "${[dict get $SUMMARIES bootsupport]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bootsupport]}} {${[dict get $HELPTEXTS bootsupport]}}
@form -synopsis "make.tcl bootsupport ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3547,7 +3548,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfscommonupdate]}" -& -summary "${[dict get $SUMMARIES vfscommonupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfscommonupdate]}} {${[dict get $HELPTEXTS vfscommonupdate]}}
@form -synopsis "make.tcl vfscommonupdate ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3559,7 +3559,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES info]}" -& -summary "${[dict get $SUMMARIES info]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS info]}} {${[dict get $HELPTEXTS info]}}
@form -synopsis "make.tcl info ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3570,7 +3569,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES check]}" -& -summary "${[dict get $SUMMARIES check]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS check]}} {${[dict get $HELPTEXTS check]}}
@form -synopsis "make.tcl check"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3580,7 +3578,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES projectversion]}" -& -summary "${[dict get $SUMMARIES projectversion]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS projectversion]}} {${[dict get $HELPTEXTS projectversion]}}
@form -synopsis "make.tcl projectversion"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3590,7 +3587,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES workflow]}" -& -summary "${[dict get $SUMMARIES workflow]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS workflow]}} {${[dict get $HELPTEXTS workflow]}}
@form -synopsis "make.tcl workflow"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3602,7 +3598,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
"Run the punk shell (repl) using bootsupport libraries. "Run the punk shell (repl) using bootsupport libraries.
All arguments after the shell subcommand are passed through to the All arguments after the shell subcommand are passed through to the
repl untouched (they are not parsed or validated by make.tcl)." repl untouched (they are not parsed or validated by make.tcl)."
@form -synopsis "make.tcl shell ?arg ...?"
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& arg -type any -optional 1 -multiple 1 -help -&
"Arguments passed through to the punk repl." "Arguments passed through to the punk repl."
@ -3613,11 +3608,28 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES buildsuite]}" -& -summary "${[dict get $SUMMARIES buildsuite]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS buildsuite]}} {${[dict get $HELPTEXTS buildsuite]}}
@form -synopsis "make.tcl buildsuite list|info|build ?<suitename>? ?driver-args ...?" @form -form {list info build}
@values -min 0 -max -1 @form -form list
arg -type any -optional 1 -multiple 1 -help -& @leaders -min 1 -max 1
"Action (list|info|build), suite name, and - for build - driver action -choices {list} -choicelabels -&
arguments forwarded to the suite's suite.tcl untouched." {list "Discover the suites (directories carrying a suite.tcl driver) with their one-line descriptions"}
@values -min 0 -max 0
@form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Show a suite's configured detail: description, source records, zig pin, products, doc pointers"}
@values -min 1 -max 1
suitename -type string -optional 0 -help -&
"Suite name (a directory under src/buildsuites carrying a suite.tcl driver)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Run the suite's driver ('suite.tcl build'), forwarding trailing args untouched"}
@values -min 1 -max -1
suitename -type string -optional 0 -help -&
"Suite to build."
driverarg -type any -optional 1 -multiple 1 -help -&
"Driver arguments forwarded to suite.tcl untouched (e.g -tclbranch/-refresh/-steps)."
} }
punk::args::define { punk::args::define {
@ -3626,11 +3638,38 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES tool]}" -& -summary "${[dict get $SUMMARIES tool]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS tool]}} {${[dict get $HELPTEXTS tool]}}
@form -synopsis "make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" @form -form {list info build test}
@form -form list
@leaders -min 1 -max 1
action -choices {list} -choicelabels -&
{list "Discover the tools with version, zig floor, install state and vendored commit; report the resolved toolchain"}
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& toolname -type string -optional 1 -multiple 1 -&
"Action (list|info|build|test), tool name(s), and - for build - -help "Validated against the configured tools (list reports all regardless)."
the -test 0|1 gate flag. Parsed by the handler." @form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Per-tool detail: paths, provenance records, toolchain resolution"}
@values -min 1 -max -1
toolname -type string -optional 0 -multiple 1 -&
-help "Tool(s) to describe (directory names under src/tools)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Resolve zig, run the test gate, build ReleaseSafe and install to <projectdir>/bin"}
@opts
-test -type boolean -default 1 -help -&
"Run the 'zig build test' gate before building (default 1). The gate is the exit code."
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to build; with no name, all tools are processed."
@form -form test
@leaders -min 1 -max 1
action -choices {test} -choicelabels -&
{test "Run each tool's 'zig build test' only"}
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to test; with no name, all tools are processed."
} }
punk::args::define { punk::args::define {
@ -3639,11 +3678,13 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES help]}" -& -summary "${[dict get $SUMMARIES help]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS help]}} {${[dict get $HELPTEXTS help]}}
@form -synopsis "make.tcl help ?subcommand?" @values -min 1 -max 2
@values -min 1 -max 1
subject -type string -optional 0 -& subject -type string -optional 0 -&
-choices {${[dict keys $SUMMARIES]}} -& -choices {${[dict keys $SUMMARIES]}} -&
-help "Subcommand to show usage for." -help "Subcommand to show usage for."
action -type string -optional 1 -help -&
"Action word (or 0-based form index) of a multi-form subcommand
(tool, buildsuite) - shows that action's single-form usage."
} }
#top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help'
variable SUBGROUPS { variable SUBGROUPS {
@ -3664,16 +3705,21 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
'bin' and 'modules' folders at the same level as 'src'. 'bin' and 'modules' folders at the same level as 'src'.
General usage: make.tcl <subcommand> ?flags? General usage: make.tcl <subcommand> ?flags?
'make.tcl help <subcommand>' or 'make.tcl <subcommand> -help' shows a 'make.tcl help <subcommand> ?action?' or 'make.tcl <subcommand> ?action? -help'
subcommand's own usage. Interactive y/n confirmations can be driven shows a subcommand's own usage (a single action's usage for the
non-interactively with the -confirm flag declared on the relevant multi-form tool/buildsuite subcommands). Interactive y/n
subcommands.} confirmations can be driven non-interactively with the -confirm
flag declared on the relevant subcommands.}
punk::args::define { punk::args::define {
@id -id "(script)::punkboot" @id -id "(script)::punkboot"
@cmd -name "make.tcl" -& @cmd -name "make.tcl" -&
-summary "punkshell project build tool (punk boot)" -& -summary "punkshell project build tool (punk boot)" -&
-help -& -help -&
{${$TOPLEVEL_HELP}} {${$TOPLEVEL_HELP}}
#sole remaining explicit synopsis override (G-143 retired the per-subcommand
#ones per G-144's @cmd -name auto-synopsis): the auto render would show the
#subcommand leader as mandatory - this line states the bare-invocation and
#per-subcommand-flags reality the declaration cannot.
@form -synopsis "make.tcl ?subcommand? ?flags?" @form -synopsis "make.tcl ?subcommand? ?flags?"
@leaders -min 1 -max 1 @leaders -min 1 -max 1
subcommand -type string -optional 0 -choicecolumns 1 -& subcommand -type string -optional 0 -choicecolumns 1 -&
@ -3708,6 +3754,7 @@ if {$::punkboot::punkargs_ok && [package provide punk::ansi] ne "" && [package p
set do_help 0 set do_help 0
set help_subject "" set help_subject ""
set help_action ""
set help_exitcode 0 set help_exitcode 0
#defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these) #defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these)
set ::punkboot::opt_forcekill 0 set ::punkboot::opt_forcekill 0
@ -3743,10 +3790,26 @@ if {$::punkboot::punkargs_ok} {
exit 1 exit 1
} }
set help_subject [dict get $argd values subject] set help_subject [dict get $argd values subject]
if {[dict exists $argd values action]} {
#G-143: 'make.tcl help <subcommand> <action>' renders the action's
#single-form usage (resolved against the subject's forms below)
set help_action [dict get $argd values action]
}
} }
} elseif {$wants_help} { } elseif {$wants_help} {
set do_help 1 set do_help 1
set help_subject $subcommand set help_subject $subcommand
#G-143: '<subcommand> <action> -help' routes to the action's single-form
#usage when the subcommand is declared multi-form (tool, buildsuite) -
#the action candidate is the first non-flag word. Single-form subcommands
#keep the historic whole-subcommand render (trailing words ignored).
set firstword ""
foreach w $subargs {
if {![string match -* $w]} {set firstword $w ; break}
}
if {$firstword ne "" && [llength [punk::args::forms (script)::punkboot::$subcommand]] > 1} {
set help_action $firstword
}
} elseif {$subcommand eq "shell"} { } elseif {$subcommand eq "shell"} {
#declared passthrough: everything after 'shell' goes to the repl unparsed #declared passthrough: everything after 'shell' goes to the repl unparsed
set ::punkboot::command shell set ::punkboot::command shell
@ -3756,9 +3819,29 @@ if {$::punkboot::punkargs_ok} {
set ::punkboot::command buildsuite set ::punkboot::command buildsuite
set ::punkboot::bs_args $subargs set ::punkboot::bs_args $subargs
} elseif {$subcommand eq "tool"} { } elseif {$subcommand eq "tool"} {
#declared passthrough: the handler parses action/names/-test itself (G-126) #G-143: tool is declared multi-form (one @form per action) and dispatch
#parses through the definition - unknown actions and unknown flags in
#option position produce pointed punk::args usage errors (exit 1). The
#definition's positional model puts -test before the tool names
#('make.tcl tool build -test 0 <name> ...'); the historic flag-anywhere
#order is not carried over (docs updated). Bare 'tool' selects the list
#form. The degraded plain scan keeps the historic manual tail parse
#(handler-side, exit-2 surface preserved there).
if {![llength $subargs]} {set subargs [list list]}
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::tool} argd]} {
puts stderr $argd
exit 1
}
set ::punkboot::command tool set ::punkboot::command tool
set ::punkboot::tool_args $subargs set ::punkboot::tool_action [dict get $argd form]
set ::punkboot::tool_names [list]
if {[dict exists $argd values toolname]} {
set ::punkboot::tool_names [dict get $argd values toolname]
}
set ::punkboot::tool_dotest 1
if {[dict exists $argd opts -test]} {
set ::punkboot::tool_dotest [dict get $argd opts -test]
}
} else { } else {
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} { if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} {
puts stderr $argd puts stderr $argd
@ -3871,7 +3954,32 @@ if {$do_help} {
if {$help_subject ne ""} { if {$help_subject ne ""} {
set usage_id (script)::punkboot::$help_subject set usage_id (script)::punkboot::$help_subject
} }
if {![catch {punk::args::usage $usage_id} usage_out]} { set usage_args [list]
if {$help_action ne ""} {
#G-143: per-action single-form usage. An unknown action word is a pointed
#punk::args usage error (exit 1) - never a plain-help fallback. Form
#names resolve by unambiguous prefix, matching the dispatch convention;
#a 0-based form INDEX is also accepted - the notation punk::args itself
#advertises (the ' i -form N ...' synopsis hints and its -form error
#messages both speak indexes).
set form_names [punk::args::forms $usage_id]
set fmatch [tcl::prefix::match -error "" $form_names $help_action]
if {$fmatch eq "" && [string is integer -strict $help_action]
&& $help_action >= 0 && $help_action < [llength $form_names]} {
set fmatch [lindex $form_names $help_action]
}
if {$fmatch eq ""} {
if {[catch {punk::args::usage -form $help_action $usage_id} usage_err]} {
puts stderr $usage_err
} else {
puts stderr "make.tcl: no action '$help_action' for '$help_subject' (actions: $form_names)"
}
exit 1
}
set help_action $fmatch
lappend usage_args -form $help_action
}
if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} {
puts stdout $usage_out puts stdout $usage_out
set availability_note [::punkboot::punkboot_availability_note] set availability_note [::punkboot::punkboot_availability_note]
if {$availability_note ne ""} { if {$availability_note ne ""} {
@ -5126,6 +5234,15 @@ if {$::punkboot::command eq "tool"} {
#fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in #fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in
#place between builds for rebuild speed (both git- and fossil-ignored). #place between builds for rebuild speed (both git- and fossil-ignored).
set tool_root [file join $sourcefolder tools] set tool_root [file join $sourcefolder tools]
if {$::punkboot::punkargs_ok} {
#G-143: action/names/-test already parsed through the multi-form definition
#at dispatch (pointed punk::args usage errors for unknown actions/flags).
set tool_action $::punkboot::tool_action
set tool_names $::punkboot::tool_names
set tool_dotest $::punkboot::tool_dotest
} else {
#degraded plain scan: the handler's historic manual tail parse (its unknown
#action / bad -test exit-2 surface is preserved in this mode)
if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]} if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]}
set targs $::punkboot::tool_args set targs $::punkboot::tool_args
set tool_action [lindex $targs 0] set tool_action [lindex $targs 0]
@ -5150,6 +5267,7 @@ if {$::punkboot::command eq "tool"} {
incr _i incr _i
} }
unset -nocomplain _i a v unset -nocomplain _i a v
}
proc ::punkboot::tool_dirs {tool_root} { proc ::punkboot::tool_dirs {tool_root} {
set dirs [list] set dirs [list]
@ -5297,6 +5415,9 @@ if {$::punkboot::command eq "tool"} {
set selected [list] set selected [list]
foreach n $tool_names { foreach n $tool_names {
if {![dict exists $byname $n]} { if {![dict exists $byname $n]} {
if {[string match -* $n]} {
puts stderr "tool: '$n' looks like a flag - options precede the tool names (e.g 'make.tcl tool build -test 0 <name> ...')"
}
puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]" puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]"
exit 2 exit 2
} }
@ -5340,7 +5461,7 @@ if {$::punkboot::command eq "tool"} {
} }
puts stdout "" puts stdout ""
puts stdout " - 'make.tcl tool info <name>' shows a tool's detail" puts stdout " - 'make.tcl tool info <name>' shows a tool's detail"
puts stdout " - 'make.tcl tool build ?<name> ...? ?-test 0|1?' builds (test-gated) and installs to bin/" puts stdout " - 'make.tcl tool build ?-test 0|1? ?<name> ...?' builds (test-gated) and installs to bin/"
puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step" puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step"
exit 0 exit 0
} }
@ -5446,7 +5567,7 @@ if {$::punkboot::command eq "tool"} {
} }
default { default {
puts stderr "unknown tool action '$tool_action' - expected list|info|build|test" puts stderr "unknown tool action '$tool_action' - expected list|info|build|test"
puts stderr "usage: make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" puts stderr "usage: make.tcl tool list|info|build|test ?-test 0|1? ?<toolname> ...?"
exit 2 exit 2
} }
} }

209
src/project_layouts/vendor/punk/basic/src/make.tcl vendored

@ -2610,13 +2610,18 @@ proc ::punkboot::punkboot_gethelp {args} {
append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n
append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n
append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n
append h " $scriptname tool list|info|build|test ?<toolname> ...? ?-test 0|1?" \n append h " $scriptname tool list ?<toolname> ...?" \n
append h " $scriptname tool info <toolname> ..." \n
append h " $scriptname tool build ?-test 0|1? ?<toolname> ...?" \n
append h " $scriptname tool test ?<toolname> ...?" \n
append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n
append h " test suites, or build (test-gated) and install to <projectdir>/bin" \n append h " test suites, or build (test-gated) and install to <projectdir>/bin; options precede the tool names" \n
append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n
append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n
append h " $scriptname help ?subcommand?" \n append h " $scriptname help ?subcommand? ?action?" \n
append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help)" \n \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help);" \n
append h " with an action word or 0-based form index, that action's single-form usage when the tabled help" \n
append h " is available" \n \n
append h " Flags:" \n append h " Flags:" \n
append h " -confirm 0|1" \n append h " -confirm 0|1" \n
append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n
@ -3234,7 +3239,11 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
help help
" "
Show tabled usage for make.tcl as a whole, or for a single subcommand. Show tabled usage for make.tcl as a whole, or for a single subcommand.
Equivalent to 'make.tcl <subcommand> -help'." Equivalent to 'make.tcl <subcommand> -help'. For the multi-form
subcommands (tool, buildsuite) an action word - or the 0-based form
index the synopsis hints display - narrows to that action's
single-form usage: 'make.tcl help tool build', 'make.tcl help tool 2'
and 'make.tcl tool build -help' all render the build form."
buildsuite buildsuite
" "
Surface for the defined buildsuites under src/buildsuites (zig-built Surface for the defined buildsuites under src/buildsuites (zig-built
@ -3278,16 +3287,19 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
tool info <name> ... tool info <name> ...
Per-tool detail: paths, provenance records, toolchain Per-tool detail: paths, provenance records, toolchain
resolution. resolution.
tool build ?<name> ...? ?-test 0|1? tool build ?-test 0|1? ?<name> ...?
Resolve a zig satisfying the tool's declared floor, run the Resolve a zig satisfying the tool's declared floor, run the
'zig build test' gate (default on; the gate is the EXIT CODE - 'zig build test' gate (default on; the gate is the EXIT CODE -
expected warnings on stderr do not fail it), build ReleaseSafe expected warnings on stderr do not fail it), build ReleaseSafe
and install to <projectdir>/bin. Nothing is installed when the and install to <projectdir>/bin. Nothing is installed when the
gate or the build fails. With no name, all tools are gate or the build fails. Options precede the tool names
(punk::args positional model); with no name, all tools are
processed. processed.
tool test ?<name> ...? tool test ?<name> ...?
Run each tool's 'zig build test' only. Run each tool's 'zig build test' only.
'make.tcl help tool <action>' shows a single action's usage table.
Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder> Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder>
overrides; otherwise <projectdir>/bin/tools/zig* is scanned and overrides; otherwise <projectdir>/bin/tools/zig* is scanned and
the LOWEST release satisfying the floor wins (deterministic as the LOWEST release satisfying the floor wins (deterministic as
@ -3404,7 +3416,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakehouse]}" -& -summary "${[dict get $SUMMARIES bakehouse]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakehouse]}} {${[dict get $HELPTEXTS bakehouse]}}
@form -synopsis "make.tcl bakehouse ?-k? ?-dirty-abort 1|0? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT_ON} ${$OPT_DIRTYABORT_ON}
@ -3417,7 +3428,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES packages]}" -& -summary "${[dict get $SUMMARIES packages]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS packages]}} {${[dict get $HELPTEXTS packages]}}
@form -synopsis "make.tcl packages ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3429,7 +3439,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES modules]}" -& -summary "${[dict get $SUMMARIES modules]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS modules]}} {${[dict get $HELPTEXTS modules]}}
@form -synopsis "make.tcl modules ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3441,7 +3450,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libs]}" -& -summary "${[dict get $SUMMARIES libs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libs]}} {${[dict get $HELPTEXTS libs]}}
@form -synopsis "make.tcl libs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3453,7 +3461,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bake]}" -& -summary "${[dict get $SUMMARIES bake]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bake]}} {${[dict get $HELPTEXTS bake]}}
@form -synopsis "make.tcl bake ?-k? ?-dirty-abort? ?-confirm 0|1? ?kitname ...?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3472,7 +3479,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakelist]}" -& -summary "${[dict get $SUMMARIES bakelist]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakelist]}} {${[dict get $HELPTEXTS bakelist]}}
@form -synopsis "make.tcl bakelist ?kitname ...?"
@values -min 0 -max -1 @values -min 0 -max -1
kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -& kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -&
"Configured kit output(s) to report on - a kit name, or @<groupname> "Configured kit output(s) to report on - a kit name, or @<groupname>
@ -3486,7 +3492,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfslibs]}" -& -summary "${[dict get $SUMMARIES vfslibs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfslibs]}} {${[dict get $HELPTEXTS vfslibs]}}
@form -synopsis "make.tcl vfslibs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3498,7 +3503,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bin]}" -& -summary "${[dict get $SUMMARIES bin]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bin]}} {${[dict get $HELPTEXTS bin]}}
@form -synopsis "make.tcl bin ?-k? ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3511,7 +3515,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vendorupdate]}" -& -summary "${[dict get $SUMMARIES vendorupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vendorupdate]}} {${[dict get $HELPTEXTS vendorupdate]}}
@form -synopsis "make.tcl vendorupdate ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3522,7 +3525,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libfetch]}" -& -summary "${[dict get $SUMMARIES libfetch]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libfetch]}} {${[dict get $HELPTEXTS libfetch]}}
@form -synopsis "make.tcl libfetch ?-serverurl <url>? ?-trust-server? ?-force?"
@opts @opts
${$OPT_SERVERURL} ${$OPT_SERVERURL}
${$OPT_TRUSTSERVER} ${$OPT_TRUSTSERVER}
@ -3535,7 +3537,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bootsupport]}" -& -summary "${[dict get $SUMMARIES bootsupport]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bootsupport]}} {${[dict get $HELPTEXTS bootsupport]}}
@form -synopsis "make.tcl bootsupport ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3547,7 +3548,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfscommonupdate]}" -& -summary "${[dict get $SUMMARIES vfscommonupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfscommonupdate]}} {${[dict get $HELPTEXTS vfscommonupdate]}}
@form -synopsis "make.tcl vfscommonupdate ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3559,7 +3559,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES info]}" -& -summary "${[dict get $SUMMARIES info]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS info]}} {${[dict get $HELPTEXTS info]}}
@form -synopsis "make.tcl info ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3570,7 +3569,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES check]}" -& -summary "${[dict get $SUMMARIES check]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS check]}} {${[dict get $HELPTEXTS check]}}
@form -synopsis "make.tcl check"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3580,7 +3578,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES projectversion]}" -& -summary "${[dict get $SUMMARIES projectversion]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS projectversion]}} {${[dict get $HELPTEXTS projectversion]}}
@form -synopsis "make.tcl projectversion"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3590,7 +3587,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES workflow]}" -& -summary "${[dict get $SUMMARIES workflow]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS workflow]}} {${[dict get $HELPTEXTS workflow]}}
@form -synopsis "make.tcl workflow"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3602,7 +3598,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
"Run the punk shell (repl) using bootsupport libraries. "Run the punk shell (repl) using bootsupport libraries.
All arguments after the shell subcommand are passed through to the All arguments after the shell subcommand are passed through to the
repl untouched (they are not parsed or validated by make.tcl)." repl untouched (they are not parsed or validated by make.tcl)."
@form -synopsis "make.tcl shell ?arg ...?"
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& arg -type any -optional 1 -multiple 1 -help -&
"Arguments passed through to the punk repl." "Arguments passed through to the punk repl."
@ -3613,11 +3608,28 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES buildsuite]}" -& -summary "${[dict get $SUMMARIES buildsuite]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS buildsuite]}} {${[dict get $HELPTEXTS buildsuite]}}
@form -synopsis "make.tcl buildsuite list|info|build ?<suitename>? ?driver-args ...?" @form -form {list info build}
@values -min 0 -max -1 @form -form list
arg -type any -optional 1 -multiple 1 -help -& @leaders -min 1 -max 1
"Action (list|info|build), suite name, and - for build - driver action -choices {list} -choicelabels -&
arguments forwarded to the suite's suite.tcl untouched." {list "Discover the suites (directories carrying a suite.tcl driver) with their one-line descriptions"}
@values -min 0 -max 0
@form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Show a suite's configured detail: description, source records, zig pin, products, doc pointers"}
@values -min 1 -max 1
suitename -type string -optional 0 -help -&
"Suite name (a directory under src/buildsuites carrying a suite.tcl driver)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Run the suite's driver ('suite.tcl build'), forwarding trailing args untouched"}
@values -min 1 -max -1
suitename -type string -optional 0 -help -&
"Suite to build."
driverarg -type any -optional 1 -multiple 1 -help -&
"Driver arguments forwarded to suite.tcl untouched (e.g -tclbranch/-refresh/-steps)."
} }
punk::args::define { punk::args::define {
@ -3626,11 +3638,38 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES tool]}" -& -summary "${[dict get $SUMMARIES tool]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS tool]}} {${[dict get $HELPTEXTS tool]}}
@form -synopsis "make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" @form -form {list info build test}
@form -form list
@leaders -min 1 -max 1
action -choices {list} -choicelabels -&
{list "Discover the tools with version, zig floor, install state and vendored commit; report the resolved toolchain"}
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& toolname -type string -optional 1 -multiple 1 -&
"Action (list|info|build|test), tool name(s), and - for build - -help "Validated against the configured tools (list reports all regardless)."
the -test 0|1 gate flag. Parsed by the handler." @form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Per-tool detail: paths, provenance records, toolchain resolution"}
@values -min 1 -max -1
toolname -type string -optional 0 -multiple 1 -&
-help "Tool(s) to describe (directory names under src/tools)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Resolve zig, run the test gate, build ReleaseSafe and install to <projectdir>/bin"}
@opts
-test -type boolean -default 1 -help -&
"Run the 'zig build test' gate before building (default 1). The gate is the exit code."
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to build; with no name, all tools are processed."
@form -form test
@leaders -min 1 -max 1
action -choices {test} -choicelabels -&
{test "Run each tool's 'zig build test' only"}
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to test; with no name, all tools are processed."
} }
punk::args::define { punk::args::define {
@ -3639,11 +3678,13 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES help]}" -& -summary "${[dict get $SUMMARIES help]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS help]}} {${[dict get $HELPTEXTS help]}}
@form -synopsis "make.tcl help ?subcommand?" @values -min 1 -max 2
@values -min 1 -max 1
subject -type string -optional 0 -& subject -type string -optional 0 -&
-choices {${[dict keys $SUMMARIES]}} -& -choices {${[dict keys $SUMMARIES]}} -&
-help "Subcommand to show usage for." -help "Subcommand to show usage for."
action -type string -optional 1 -help -&
"Action word (or 0-based form index) of a multi-form subcommand
(tool, buildsuite) - shows that action's single-form usage."
} }
#top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help'
variable SUBGROUPS { variable SUBGROUPS {
@ -3664,16 +3705,21 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
'bin' and 'modules' folders at the same level as 'src'. 'bin' and 'modules' folders at the same level as 'src'.
General usage: make.tcl <subcommand> ?flags? General usage: make.tcl <subcommand> ?flags?
'make.tcl help <subcommand>' or 'make.tcl <subcommand> -help' shows a 'make.tcl help <subcommand> ?action?' or 'make.tcl <subcommand> ?action? -help'
subcommand's own usage. Interactive y/n confirmations can be driven shows a subcommand's own usage (a single action's usage for the
non-interactively with the -confirm flag declared on the relevant multi-form tool/buildsuite subcommands). Interactive y/n
subcommands.} confirmations can be driven non-interactively with the -confirm
flag declared on the relevant subcommands.}
punk::args::define { punk::args::define {
@id -id "(script)::punkboot" @id -id "(script)::punkboot"
@cmd -name "make.tcl" -& @cmd -name "make.tcl" -&
-summary "punkshell project build tool (punk boot)" -& -summary "punkshell project build tool (punk boot)" -&
-help -& -help -&
{${$TOPLEVEL_HELP}} {${$TOPLEVEL_HELP}}
#sole remaining explicit synopsis override (G-143 retired the per-subcommand
#ones per G-144's @cmd -name auto-synopsis): the auto render would show the
#subcommand leader as mandatory - this line states the bare-invocation and
#per-subcommand-flags reality the declaration cannot.
@form -synopsis "make.tcl ?subcommand? ?flags?" @form -synopsis "make.tcl ?subcommand? ?flags?"
@leaders -min 1 -max 1 @leaders -min 1 -max 1
subcommand -type string -optional 0 -choicecolumns 1 -& subcommand -type string -optional 0 -choicecolumns 1 -&
@ -3708,6 +3754,7 @@ if {$::punkboot::punkargs_ok && [package provide punk::ansi] ne "" && [package p
set do_help 0 set do_help 0
set help_subject "" set help_subject ""
set help_action ""
set help_exitcode 0 set help_exitcode 0
#defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these) #defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these)
set ::punkboot::opt_forcekill 0 set ::punkboot::opt_forcekill 0
@ -3743,10 +3790,26 @@ if {$::punkboot::punkargs_ok} {
exit 1 exit 1
} }
set help_subject [dict get $argd values subject] set help_subject [dict get $argd values subject]
if {[dict exists $argd values action]} {
#G-143: 'make.tcl help <subcommand> <action>' renders the action's
#single-form usage (resolved against the subject's forms below)
set help_action [dict get $argd values action]
}
} }
} elseif {$wants_help} { } elseif {$wants_help} {
set do_help 1 set do_help 1
set help_subject $subcommand set help_subject $subcommand
#G-143: '<subcommand> <action> -help' routes to the action's single-form
#usage when the subcommand is declared multi-form (tool, buildsuite) -
#the action candidate is the first non-flag word. Single-form subcommands
#keep the historic whole-subcommand render (trailing words ignored).
set firstword ""
foreach w $subargs {
if {![string match -* $w]} {set firstword $w ; break}
}
if {$firstword ne "" && [llength [punk::args::forms (script)::punkboot::$subcommand]] > 1} {
set help_action $firstword
}
} elseif {$subcommand eq "shell"} { } elseif {$subcommand eq "shell"} {
#declared passthrough: everything after 'shell' goes to the repl unparsed #declared passthrough: everything after 'shell' goes to the repl unparsed
set ::punkboot::command shell set ::punkboot::command shell
@ -3756,9 +3819,29 @@ if {$::punkboot::punkargs_ok} {
set ::punkboot::command buildsuite set ::punkboot::command buildsuite
set ::punkboot::bs_args $subargs set ::punkboot::bs_args $subargs
} elseif {$subcommand eq "tool"} { } elseif {$subcommand eq "tool"} {
#declared passthrough: the handler parses action/names/-test itself (G-126) #G-143: tool is declared multi-form (one @form per action) and dispatch
#parses through the definition - unknown actions and unknown flags in
#option position produce pointed punk::args usage errors (exit 1). The
#definition's positional model puts -test before the tool names
#('make.tcl tool build -test 0 <name> ...'); the historic flag-anywhere
#order is not carried over (docs updated). Bare 'tool' selects the list
#form. The degraded plain scan keeps the historic manual tail parse
#(handler-side, exit-2 surface preserved there).
if {![llength $subargs]} {set subargs [list list]}
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::tool} argd]} {
puts stderr $argd
exit 1
}
set ::punkboot::command tool set ::punkboot::command tool
set ::punkboot::tool_args $subargs set ::punkboot::tool_action [dict get $argd form]
set ::punkboot::tool_names [list]
if {[dict exists $argd values toolname]} {
set ::punkboot::tool_names [dict get $argd values toolname]
}
set ::punkboot::tool_dotest 1
if {[dict exists $argd opts -test]} {
set ::punkboot::tool_dotest [dict get $argd opts -test]
}
} else { } else {
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} { if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} {
puts stderr $argd puts stderr $argd
@ -3871,7 +3954,32 @@ if {$do_help} {
if {$help_subject ne ""} { if {$help_subject ne ""} {
set usage_id (script)::punkboot::$help_subject set usage_id (script)::punkboot::$help_subject
} }
if {![catch {punk::args::usage $usage_id} usage_out]} { set usage_args [list]
if {$help_action ne ""} {
#G-143: per-action single-form usage. An unknown action word is a pointed
#punk::args usage error (exit 1) - never a plain-help fallback. Form
#names resolve by unambiguous prefix, matching the dispatch convention;
#a 0-based form INDEX is also accepted - the notation punk::args itself
#advertises (the ' i -form N ...' synopsis hints and its -form error
#messages both speak indexes).
set form_names [punk::args::forms $usage_id]
set fmatch [tcl::prefix::match -error "" $form_names $help_action]
if {$fmatch eq "" && [string is integer -strict $help_action]
&& $help_action >= 0 && $help_action < [llength $form_names]} {
set fmatch [lindex $form_names $help_action]
}
if {$fmatch eq ""} {
if {[catch {punk::args::usage -form $help_action $usage_id} usage_err]} {
puts stderr $usage_err
} else {
puts stderr "make.tcl: no action '$help_action' for '$help_subject' (actions: $form_names)"
}
exit 1
}
set help_action $fmatch
lappend usage_args -form $help_action
}
if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} {
puts stdout $usage_out puts stdout $usage_out
set availability_note [::punkboot::punkboot_availability_note] set availability_note [::punkboot::punkboot_availability_note]
if {$availability_note ne ""} { if {$availability_note ne ""} {
@ -5126,6 +5234,15 @@ if {$::punkboot::command eq "tool"} {
#fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in #fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in
#place between builds for rebuild speed (both git- and fossil-ignored). #place between builds for rebuild speed (both git- and fossil-ignored).
set tool_root [file join $sourcefolder tools] set tool_root [file join $sourcefolder tools]
if {$::punkboot::punkargs_ok} {
#G-143: action/names/-test already parsed through the multi-form definition
#at dispatch (pointed punk::args usage errors for unknown actions/flags).
set tool_action $::punkboot::tool_action
set tool_names $::punkboot::tool_names
set tool_dotest $::punkboot::tool_dotest
} else {
#degraded plain scan: the handler's historic manual tail parse (its unknown
#action / bad -test exit-2 surface is preserved in this mode)
if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]} if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]}
set targs $::punkboot::tool_args set targs $::punkboot::tool_args
set tool_action [lindex $targs 0] set tool_action [lindex $targs 0]
@ -5150,6 +5267,7 @@ if {$::punkboot::command eq "tool"} {
incr _i incr _i
} }
unset -nocomplain _i a v unset -nocomplain _i a v
}
proc ::punkboot::tool_dirs {tool_root} { proc ::punkboot::tool_dirs {tool_root} {
set dirs [list] set dirs [list]
@ -5297,6 +5415,9 @@ if {$::punkboot::command eq "tool"} {
set selected [list] set selected [list]
foreach n $tool_names { foreach n $tool_names {
if {![dict exists $byname $n]} { if {![dict exists $byname $n]} {
if {[string match -* $n]} {
puts stderr "tool: '$n' looks like a flag - options precede the tool names (e.g 'make.tcl tool build -test 0 <name> ...')"
}
puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]" puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]"
exit 2 exit 2
} }
@ -5340,7 +5461,7 @@ if {$::punkboot::command eq "tool"} {
} }
puts stdout "" puts stdout ""
puts stdout " - 'make.tcl tool info <name>' shows a tool's detail" puts stdout " - 'make.tcl tool info <name>' shows a tool's detail"
puts stdout " - 'make.tcl tool build ?<name> ...? ?-test 0|1?' builds (test-gated) and installs to bin/" puts stdout " - 'make.tcl tool build ?-test 0|1? ?<name> ...?' builds (test-gated) and installs to bin/"
puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step" puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step"
exit 0 exit 0
} }
@ -5446,7 +5567,7 @@ if {$::punkboot::command eq "tool"} {
} }
default { default {
puts stderr "unknown tool action '$tool_action' - expected list|info|build|test" puts stderr "unknown tool action '$tool_action' - expected list|info|build|test"
puts stderr "usage: make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" puts stderr "usage: make.tcl tool list|info|build|test ?-test 0|1? ?<toolname> ...?"
exit 2 exit 2
} }
} }

209
src/project_layouts/vendor/punk/project-0.1/src/make.tcl vendored

@ -2610,13 +2610,18 @@ proc ::punkboot::punkboot_gethelp {args} {
append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n append h " $scriptname buildsuite list|info|build ?<suitename>? ?driver-args ...?" \n
append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n append h " - list the defined buildsuites under src/buildsuites (zig runtime factory), show a suite's configured" \n
append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n append h " detail (sources/zig pin/products from its sources.config), or run its driver forwarding the args" \n \n
append h " $scriptname tool list|info|build|test ?<toolname> ...? ?-test 0|1?" \n append h " $scriptname tool list ?<toolname> ...?" \n
append h " $scriptname tool info <toolname> ..." \n
append h " $scriptname tool build ?-test 0|1? ?<toolname> ...?" \n
append h " $scriptname tool test ?<toolname> ...?" \n
append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n append h " - vendored first-party build tools under src/tools (zig source; G-126): list/detail them, run their" \n
append h " test suites, or build (test-gated) and install to <projectdir>/bin" \n append h " test suites, or build (test-gated) and install to <projectdir>/bin; options precede the tool names" \n
append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n append h " - zig is OPTIONAL: packages/bake never require this step; without a suitable toolchain the state is" \n
append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n append h " reported and build/test exit nonzero with fetch guidance (bin/punk-getzig.cmd)" \n \n
append h " $scriptname help ?subcommand?" \n append h " $scriptname help ?subcommand? ?action?" \n
append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help)" \n \n append h " - show usage for $scriptname or one of its subcommands (equivalent: $scriptname <subcommand> -help);" \n
append h " with an action word or 0-based form index, that action's single-form usage when the tabled help" \n
append h " is available" \n \n
append h " Flags:" \n append h " Flags:" \n
append h " -confirm 0|1" \n append h " -confirm 0|1" \n
append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n append h " - interactive y/n confirmation policy (default 1: prompt when stdin is a terminal, abort fast when it is not)." \n
@ -3234,7 +3239,11 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
help help
" "
Show tabled usage for make.tcl as a whole, or for a single subcommand. Show tabled usage for make.tcl as a whole, or for a single subcommand.
Equivalent to 'make.tcl <subcommand> -help'." Equivalent to 'make.tcl <subcommand> -help'. For the multi-form
subcommands (tool, buildsuite) an action word - or the 0-based form
index the synopsis hints display - narrows to that action's
single-form usage: 'make.tcl help tool build', 'make.tcl help tool 2'
and 'make.tcl tool build -help' all render the build form."
buildsuite buildsuite
" "
Surface for the defined buildsuites under src/buildsuites (zig-built Surface for the defined buildsuites under src/buildsuites (zig-built
@ -3278,16 +3287,19 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
tool info <name> ... tool info <name> ...
Per-tool detail: paths, provenance records, toolchain Per-tool detail: paths, provenance records, toolchain
resolution. resolution.
tool build ?<name> ...? ?-test 0|1? tool build ?-test 0|1? ?<name> ...?
Resolve a zig satisfying the tool's declared floor, run the Resolve a zig satisfying the tool's declared floor, run the
'zig build test' gate (default on; the gate is the EXIT CODE - 'zig build test' gate (default on; the gate is the EXIT CODE -
expected warnings on stderr do not fail it), build ReleaseSafe expected warnings on stderr do not fail it), build ReleaseSafe
and install to <projectdir>/bin. Nothing is installed when the and install to <projectdir>/bin. Nothing is installed when the
gate or the build fails. With no name, all tools are gate or the build fails. Options precede the tool names
(punk::args positional model); with no name, all tools are
processed. processed.
tool test ?<name> ...? tool test ?<name> ...?
Run each tool's 'zig build test' only. Run each tool's 'zig build test' only.
'make.tcl help tool <action>' shows a single action's usage table.
Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder> Toolchain resolution: PUNK_ZIG=<path-to-zig-or-its-folder>
overrides; otherwise <projectdir>/bin/tools/zig* is scanned and overrides; otherwise <projectdir>/bin/tools/zig* is scanned and
the LOWEST release satisfying the floor wins (deterministic as the LOWEST release satisfying the floor wins (deterministic as
@ -3404,7 +3416,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakehouse]}" -& -summary "${[dict get $SUMMARIES bakehouse]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakehouse]}} {${[dict get $HELPTEXTS bakehouse]}}
@form -synopsis "make.tcl bakehouse ?-k? ?-dirty-abort 1|0? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT_ON} ${$OPT_DIRTYABORT_ON}
@ -3417,7 +3428,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES packages]}" -& -summary "${[dict get $SUMMARIES packages]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS packages]}} {${[dict get $HELPTEXTS packages]}}
@form -synopsis "make.tcl packages ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3429,7 +3439,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES modules]}" -& -summary "${[dict get $SUMMARIES modules]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS modules]}} {${[dict get $HELPTEXTS modules]}}
@form -synopsis "make.tcl modules ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3441,7 +3450,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libs]}" -& -summary "${[dict get $SUMMARIES libs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libs]}} {${[dict get $HELPTEXTS libs]}}
@form -synopsis "make.tcl libs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3453,7 +3461,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bake]}" -& -summary "${[dict get $SUMMARIES bake]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bake]}} {${[dict get $HELPTEXTS bake]}}
@form -synopsis "make.tcl bake ?-k? ?-dirty-abort? ?-confirm 0|1? ?kitname ...?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3472,7 +3479,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bakelist]}" -& -summary "${[dict get $SUMMARIES bakelist]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bakelist]}} {${[dict get $HELPTEXTS bakelist]}}
@form -synopsis "make.tcl bakelist ?kitname ...?"
@values -min 0 -max -1 @values -min 0 -max -1
kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -& kitname -type string -optional 1 -multiple 1${$KITNAME_CHOICEPART} -help -&
"Configured kit output(s) to report on - a kit name, or @<groupname> "Configured kit output(s) to report on - a kit name, or @<groupname>
@ -3486,7 +3492,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfslibs]}" -& -summary "${[dict get $SUMMARIES vfslibs]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfslibs]}} {${[dict get $HELPTEXTS vfslibs]}}
@form -synopsis "make.tcl vfslibs ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3498,7 +3503,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bin]}" -& -summary "${[dict get $SUMMARIES bin]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bin]}} {${[dict get $HELPTEXTS bin]}}
@form -synopsis "make.tcl bin ?-k? ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_FORCEKILL} ${$OPT_FORCEKILL}
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
@ -3511,7 +3515,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vendorupdate]}" -& -summary "${[dict get $SUMMARIES vendorupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vendorupdate]}} {${[dict get $HELPTEXTS vendorupdate]}}
@form -synopsis "make.tcl vendorupdate ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3522,7 +3525,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES libfetch]}" -& -summary "${[dict get $SUMMARIES libfetch]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS libfetch]}} {${[dict get $HELPTEXTS libfetch]}}
@form -synopsis "make.tcl libfetch ?-serverurl <url>? ?-trust-server? ?-force?"
@opts @opts
${$OPT_SERVERURL} ${$OPT_SERVERURL}
${$OPT_TRUSTSERVER} ${$OPT_TRUSTSERVER}
@ -3535,7 +3537,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES bootsupport]}" -& -summary "${[dict get $SUMMARIES bootsupport]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS bootsupport]}} {${[dict get $HELPTEXTS bootsupport]}}
@form -synopsis "make.tcl bootsupport ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3547,7 +3548,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES vfscommonupdate]}" -& -summary "${[dict get $SUMMARIES vfscommonupdate]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS vfscommonupdate]}} {${[dict get $HELPTEXTS vfscommonupdate]}}
@form -synopsis "make.tcl vfscommonupdate ?-dirty-abort? ?-confirm 0|1?"
@opts @opts
${$OPT_DIRTYABORT} ${$OPT_DIRTYABORT}
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@ -3559,7 +3559,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES info]}" -& -summary "${[dict get $SUMMARIES info]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS info]}} {${[dict get $HELPTEXTS info]}}
@form -synopsis "make.tcl info ?-confirm 0|1?"
@opts @opts
${$OPT_CONFIRM} ${$OPT_CONFIRM}
@values -min 0 -max 0 @values -min 0 -max 0
@ -3570,7 +3569,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES check]}" -& -summary "${[dict get $SUMMARIES check]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS check]}} {${[dict get $HELPTEXTS check]}}
@form -synopsis "make.tcl check"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3580,7 +3578,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES projectversion]}" -& -summary "${[dict get $SUMMARIES projectversion]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS projectversion]}} {${[dict get $HELPTEXTS projectversion]}}
@form -synopsis "make.tcl projectversion"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3590,7 +3587,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES workflow]}" -& -summary "${[dict get $SUMMARIES workflow]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS workflow]}} {${[dict get $HELPTEXTS workflow]}}
@form -synopsis "make.tcl workflow"
@opts @opts
@values -min 0 -max 0 @values -min 0 -max 0
} }
@ -3602,7 +3598,6 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
"Run the punk shell (repl) using bootsupport libraries. "Run the punk shell (repl) using bootsupport libraries.
All arguments after the shell subcommand are passed through to the All arguments after the shell subcommand are passed through to the
repl untouched (they are not parsed or validated by make.tcl)." repl untouched (they are not parsed or validated by make.tcl)."
@form -synopsis "make.tcl shell ?arg ...?"
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& arg -type any -optional 1 -multiple 1 -help -&
"Arguments passed through to the punk repl." "Arguments passed through to the punk repl."
@ -3613,11 +3608,28 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES buildsuite]}" -& -summary "${[dict get $SUMMARIES buildsuite]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS buildsuite]}} {${[dict get $HELPTEXTS buildsuite]}}
@form -synopsis "make.tcl buildsuite list|info|build ?<suitename>? ?driver-args ...?" @form -form {list info build}
@values -min 0 -max -1 @form -form list
arg -type any -optional 1 -multiple 1 -help -& @leaders -min 1 -max 1
"Action (list|info|build), suite name, and - for build - driver action -choices {list} -choicelabels -&
arguments forwarded to the suite's suite.tcl untouched." {list "Discover the suites (directories carrying a suite.tcl driver) with their one-line descriptions"}
@values -min 0 -max 0
@form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Show a suite's configured detail: description, source records, zig pin, products, doc pointers"}
@values -min 1 -max 1
suitename -type string -optional 0 -help -&
"Suite name (a directory under src/buildsuites carrying a suite.tcl driver)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Run the suite's driver ('suite.tcl build'), forwarding trailing args untouched"}
@values -min 1 -max -1
suitename -type string -optional 0 -help -&
"Suite to build."
driverarg -type any -optional 1 -multiple 1 -help -&
"Driver arguments forwarded to suite.tcl untouched (e.g -tclbranch/-refresh/-steps)."
} }
punk::args::define { punk::args::define {
@ -3626,11 +3638,38 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES tool]}" -& -summary "${[dict get $SUMMARIES tool]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS tool]}} {${[dict get $HELPTEXTS tool]}}
@form -synopsis "make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" @form -form {list info build test}
@form -form list
@leaders -min 1 -max 1
action -choices {list} -choicelabels -&
{list "Discover the tools with version, zig floor, install state and vendored commit; report the resolved toolchain"}
@values -min 0 -max -1 @values -min 0 -max -1
arg -type any -optional 1 -multiple 1 -help -& toolname -type string -optional 1 -multiple 1 -&
"Action (list|info|build|test), tool name(s), and - for build - -help "Validated against the configured tools (list reports all regardless)."
the -test 0|1 gate flag. Parsed by the handler." @form -form info
@leaders -min 1 -max 1
action -choices {info} -choicelabels -&
{info "Per-tool detail: paths, provenance records, toolchain resolution"}
@values -min 1 -max -1
toolname -type string -optional 0 -multiple 1 -&
-help "Tool(s) to describe (directory names under src/tools)."
@form -form build
@leaders -min 1 -max 1
action -choices {build} -choicelabels -&
{build "Resolve zig, run the test gate, build ReleaseSafe and install to <projectdir>/bin"}
@opts
-test -type boolean -default 1 -help -&
"Run the 'zig build test' gate before building (default 1). The gate is the exit code."
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to build; with no name, all tools are processed."
@form -form test
@leaders -min 1 -max 1
action -choices {test} -choicelabels -&
{test "Run each tool's 'zig build test' only"}
@values -min 0 -max -1
toolname -type string -optional 1 -multiple 1 -&
-help "Tool(s) to test; with no name, all tools are processed."
} }
punk::args::define { punk::args::define {
@ -3639,11 +3678,13 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
-summary "${[dict get $SUMMARIES help]}" -& -summary "${[dict get $SUMMARIES help]}" -&
-help -& -help -&
{${[dict get $HELPTEXTS help]}} {${[dict get $HELPTEXTS help]}}
@form -synopsis "make.tcl help ?subcommand?" @values -min 1 -max 2
@values -min 1 -max 1
subject -type string -optional 0 -& subject -type string -optional 0 -&
-choices {${[dict keys $SUMMARIES]}} -& -choices {${[dict keys $SUMMARIES]}} -&
-help "Subcommand to show usage for." -help "Subcommand to show usage for."
action -type string -optional 1 -help -&
"Action word (or 0-based form index) of a multi-form subcommand
(tool, buildsuite) - shows that action's single-form usage."
} }
#top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help' #top-level definition: the subcommand table rendered by 'make.tcl' / 'make.tcl -help'
variable SUBGROUPS { variable SUBGROUPS {
@ -3664,16 +3705,21 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
'bin' and 'modules' folders at the same level as 'src'. 'bin' and 'modules' folders at the same level as 'src'.
General usage: make.tcl <subcommand> ?flags? General usage: make.tcl <subcommand> ?flags?
'make.tcl help <subcommand>' or 'make.tcl <subcommand> -help' shows a 'make.tcl help <subcommand> ?action?' or 'make.tcl <subcommand> ?action? -help'
subcommand's own usage. Interactive y/n confirmations can be driven shows a subcommand's own usage (a single action's usage for the
non-interactively with the -confirm flag declared on the relevant multi-form tool/buildsuite subcommands). Interactive y/n
subcommands.} confirmations can be driven non-interactively with the -confirm
flag declared on the relevant subcommands.}
punk::args::define { punk::args::define {
@id -id "(script)::punkboot" @id -id "(script)::punkboot"
@cmd -name "make.tcl" -& @cmd -name "make.tcl" -&
-summary "punkshell project build tool (punk boot)" -& -summary "punkshell project build tool (punk boot)" -&
-help -& -help -&
{${$TOPLEVEL_HELP}} {${$TOPLEVEL_HELP}}
#sole remaining explicit synopsis override (G-143 retired the per-subcommand
#ones per G-144's @cmd -name auto-synopsis): the auto render would show the
#subcommand leader as mandatory - this line states the bare-invocation and
#per-subcommand-flags reality the declaration cannot.
@form -synopsis "make.tcl ?subcommand? ?flags?" @form -synopsis "make.tcl ?subcommand? ?flags?"
@leaders -min 1 -max 1 @leaders -min 1 -max 1
subcommand -type string -optional 0 -choicecolumns 1 -& subcommand -type string -optional 0 -choicecolumns 1 -&
@ -3708,6 +3754,7 @@ if {$::punkboot::punkargs_ok && [package provide punk::ansi] ne "" && [package p
set do_help 0 set do_help 0
set help_subject "" set help_subject ""
set help_action ""
set help_exitcode 0 set help_exitcode 0
#defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these) #defaults for the option-derived variables (fallback scan and passthrough subcommands rely on these)
set ::punkboot::opt_forcekill 0 set ::punkboot::opt_forcekill 0
@ -3743,10 +3790,26 @@ if {$::punkboot::punkargs_ok} {
exit 1 exit 1
} }
set help_subject [dict get $argd values subject] set help_subject [dict get $argd values subject]
if {[dict exists $argd values action]} {
#G-143: 'make.tcl help <subcommand> <action>' renders the action's
#single-form usage (resolved against the subject's forms below)
set help_action [dict get $argd values action]
}
} }
} elseif {$wants_help} { } elseif {$wants_help} {
set do_help 1 set do_help 1
set help_subject $subcommand set help_subject $subcommand
#G-143: '<subcommand> <action> -help' routes to the action's single-form
#usage when the subcommand is declared multi-form (tool, buildsuite) -
#the action candidate is the first non-flag word. Single-form subcommands
#keep the historic whole-subcommand render (trailing words ignored).
set firstword ""
foreach w $subargs {
if {![string match -* $w]} {set firstword $w ; break}
}
if {$firstword ne "" && [llength [punk::args::forms (script)::punkboot::$subcommand]] > 1} {
set help_action $firstword
}
} elseif {$subcommand eq "shell"} { } elseif {$subcommand eq "shell"} {
#declared passthrough: everything after 'shell' goes to the repl unparsed #declared passthrough: everything after 'shell' goes to the repl unparsed
set ::punkboot::command shell set ::punkboot::command shell
@ -3756,9 +3819,29 @@ if {$::punkboot::punkargs_ok} {
set ::punkboot::command buildsuite set ::punkboot::command buildsuite
set ::punkboot::bs_args $subargs set ::punkboot::bs_args $subargs
} elseif {$subcommand eq "tool"} { } elseif {$subcommand eq "tool"} {
#declared passthrough: the handler parses action/names/-test itself (G-126) #G-143: tool is declared multi-form (one @form per action) and dispatch
#parses through the definition - unknown actions and unknown flags in
#option position produce pointed punk::args usage errors (exit 1). The
#definition's positional model puts -test before the tool names
#('make.tcl tool build -test 0 <name> ...'); the historic flag-anywhere
#order is not carried over (docs updated). Bare 'tool' selects the list
#form. The degraded plain scan keeps the historic manual tail parse
#(handler-side, exit-2 surface preserved there).
if {![llength $subargs]} {set subargs [list list]}
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::tool} argd]} {
puts stderr $argd
exit 1
}
set ::punkboot::command tool set ::punkboot::command tool
set ::punkboot::tool_args $subargs set ::punkboot::tool_action [dict get $argd form]
set ::punkboot::tool_names [list]
if {[dict exists $argd values toolname]} {
set ::punkboot::tool_names [dict get $argd values toolname]
}
set ::punkboot::tool_dotest 1
if {[dict exists $argd opts -test]} {
set ::punkboot::tool_dotest [dict get $argd opts -test]
}
} else { } else {
if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} { if {[catch {punk::args::parse $subargs -errorstyle $::punkboot::errstyle withid (script)::punkboot::$subcommand} argd]} {
puts stderr $argd puts stderr $argd
@ -3871,7 +3954,32 @@ if {$do_help} {
if {$help_subject ne ""} { if {$help_subject ne ""} {
set usage_id (script)::punkboot::$help_subject set usage_id (script)::punkboot::$help_subject
} }
if {![catch {punk::args::usage $usage_id} usage_out]} { set usage_args [list]
if {$help_action ne ""} {
#G-143: per-action single-form usage. An unknown action word is a pointed
#punk::args usage error (exit 1) - never a plain-help fallback. Form
#names resolve by unambiguous prefix, matching the dispatch convention;
#a 0-based form INDEX is also accepted - the notation punk::args itself
#advertises (the ' i -form N ...' synopsis hints and its -form error
#messages both speak indexes).
set form_names [punk::args::forms $usage_id]
set fmatch [tcl::prefix::match -error "" $form_names $help_action]
if {$fmatch eq "" && [string is integer -strict $help_action]
&& $help_action >= 0 && $help_action < [llength $form_names]} {
set fmatch [lindex $form_names $help_action]
}
if {$fmatch eq ""} {
if {[catch {punk::args::usage -form $help_action $usage_id} usage_err]} {
puts stderr $usage_err
} else {
puts stderr "make.tcl: no action '$help_action' for '$help_subject' (actions: $form_names)"
}
exit 1
}
set help_action $fmatch
lappend usage_args -form $help_action
}
if {![catch {punk::args::usage {*}$usage_args $usage_id} usage_out]} {
puts stdout $usage_out puts stdout $usage_out
set availability_note [::punkboot::punkboot_availability_note] set availability_note [::punkboot::punkboot_availability_note]
if {$availability_note ne ""} { if {$availability_note ne ""} {
@ -5126,6 +5234,15 @@ if {$::punkboot::command eq "tool"} {
#fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in #fetch guidance. Build caches (.zig-cache/zig-out) are deliberately left in
#place between builds for rebuild speed (both git- and fossil-ignored). #place between builds for rebuild speed (both git- and fossil-ignored).
set tool_root [file join $sourcefolder tools] set tool_root [file join $sourcefolder tools]
if {$::punkboot::punkargs_ok} {
#G-143: action/names/-test already parsed through the multi-form definition
#at dispatch (pointed punk::args usage errors for unknown actions/flags).
set tool_action $::punkboot::tool_action
set tool_names $::punkboot::tool_names
set tool_dotest $::punkboot::tool_dotest
} else {
#degraded plain scan: the handler's historic manual tail parse (its unknown
#action / bad -test exit-2 surface is preserved in this mode)
if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]} if {![info exists ::punkboot::tool_args]} {set ::punkboot::tool_args [list]}
set targs $::punkboot::tool_args set targs $::punkboot::tool_args
set tool_action [lindex $targs 0] set tool_action [lindex $targs 0]
@ -5150,6 +5267,7 @@ if {$::punkboot::command eq "tool"} {
incr _i incr _i
} }
unset -nocomplain _i a v unset -nocomplain _i a v
}
proc ::punkboot::tool_dirs {tool_root} { proc ::punkboot::tool_dirs {tool_root} {
set dirs [list] set dirs [list]
@ -5297,6 +5415,9 @@ if {$::punkboot::command eq "tool"} {
set selected [list] set selected [list]
foreach n $tool_names { foreach n $tool_names {
if {![dict exists $byname $n]} { if {![dict exists $byname $n]} {
if {[string match -* $n]} {
puts stderr "tool: '$n' looks like a flag - options precede the tool names (e.g 'make.tcl tool build -test 0 <name> ...')"
}
puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]" puts stderr "tool '$n' not found under $tool_root - configured tools: [dict keys $byname]"
exit 2 exit 2
} }
@ -5340,7 +5461,7 @@ if {$::punkboot::command eq "tool"} {
} }
puts stdout "" puts stdout ""
puts stdout " - 'make.tcl tool info <name>' shows a tool's detail" puts stdout " - 'make.tcl tool info <name>' shows a tool's detail"
puts stdout " - 'make.tcl tool build ?<name> ...? ?-test 0|1?' builds (test-gated) and installs to bin/" puts stdout " - 'make.tcl tool build ?-test 0|1? ?<name> ...?' builds (test-gated) and installs to bin/"
puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step" puts stdout " - zig is OPTIONAL for punkshell builds: packages/bake never require this step"
exit 0 exit 0
} }
@ -5446,7 +5567,7 @@ if {$::punkboot::command eq "tool"} {
} }
default { default {
puts stderr "unknown tool action '$tool_action' - expected list|info|build|test" puts stderr "unknown tool action '$tool_action' - expected list|info|build|test"
puts stderr "usage: make.tcl tool list|info|build|test ?<toolname> ...? ?-test 0|1?" puts stderr "usage: make.tcl tool list|info|build|test ?-test 0|1? ?<toolname> ...?"
exit 2 exit 2
} }
} }

Loading…
Cancel
Save