@ -8,7 +8,7 @@
# (C) Julian Noble 2024
# (C) Julian Noble 2024
#
#
# @@ Meta Begin
# @@ Meta Begin
# Application argparsingtest 1.2 .0
# Application argparsingtest 1.3 .0
# Meta platform tcl
# Meta platform tcl
# Meta license MIT
# Meta license MIT
# @@ Meta End
# @@ Meta End
@ -18,7 +18,7 @@
# doctools header
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#*** !doctools
#[manpage_begin punkshell_module_argparsingtest 0 1.2 .0]
#[manpage_begin punkshell_module_argparsingtest 0 1.3 .0]
#[copyright "2024"]
#[copyright "2024"]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
#[moddesc {-}] [comment {-- Description at end of page heading --}]
@ -50,15 +50,28 @@
package require Tcl 8.6-
package require Tcl 8.6-
package require punk::args
package require punk::args
package require opt
package require cmdline
# Every parser package this module compares is OPTIONAL, including the tcllib ones.
package require tepam
# A comparison harness that cannot load at all because one of the libraries it
# compares is absent is useless on exactly the runtime you most want to measure -
# and punkshell builds do ship without tcllib. A missing library must degrade to a
# not_loaded row (see the {optional <pkg>} roster markers), never to a load failure.
# Guarded here rather than at the call sites because the guard needed differs:
# cmdline - used only INSIDE proc bodies, so the requires below are the whole story
# opt - tcl::OptProc DEFINES the wrapper procs, so each definition site is
# tepam additionally guarded by an 'is the package present' test. Those sites
# test presence rather than catching, so a genuine error in a spec still
# surfaces loudly on a runtime that does have the package.
# argp, parse_args and argparse are required further down, at their own sites.
catch {package require opt}
catch {package require cmdline}
catch {package require tepam}
#*** !doctools
#*** !doctools
#[item] [package {Tcl 8.6}]
#[item] [package {Tcl 8.6}]
#[item] [package {punk::args}]
#[item] [package {punk::args}]
#[item] [package {opt}]
#[item] [package {opt}] (optional - parser under test)
#[item] [package {cmdline}]
#[item] [package {cmdline}] (optional - parser under test)
#[item] [package {tepam}]
#[item] [package {tepam}] (optional - parser under test)
# #package require frobz
# #package require frobz
# #*** !doctools
# #*** !doctools
@ -163,13 +176,13 @@ namespace eval argparsingtest {
punkargs_by_id always
punkargs_by_id always
punkargs_parsecache always
punkargs_parsecache always
punkargs_validate_ansistripped always
punkargs_validate_ansistripped always
opt always
opt {optional opt}
cmdline_untyped always
cmdline_untyped {optional cmdline}
cmdline_typed always
cmdline_typed {optional cmdline}
argp {optional argp}
argp {optional argp}
parse_args {optional parse_args}
parse_args {optional parse_args}
argparse {optional argparse}
argparse {optional argparse}
tepam always
tepam {optional tepam}
}
}
}
}
tkstyle {
tkstyle {
@ -180,8 +193,8 @@ namespace eval argparsingtest {
punkargs always
punkargs always
punkargs_by_id always
punkargs_by_id always
punkargs_parsecache always
punkargs_parsecache always
opt always
opt {optional opt}
tepam always
tepam {optional tepam}
argparse {optional argparse}
argparse {optional argparse}
cmdline_untyped unsupported
cmdline_untyped unsupported
cmdline_typed unsupported
cmdline_typed unsupported
@ -197,10 +210,10 @@ namespace eval argparsingtest {
punkargs always
punkargs always
punkargs_by_id always
punkargs_by_id always
punkargs_parsecache always
punkargs_parsecache always
opt always
opt {optional opt}
cmdline_untyped always
cmdline_untyped {optional cmdline}
cmdline_typed always
cmdline_typed {optional cmdline}
tepam always
tepam {optional tepam}
parse_args {optional parse_args}
parse_args {optional parse_args}
argparse {optional argparse}
argparse {optional argparse}
argp unsupported
argp unsupported
@ -214,7 +227,7 @@ namespace eval argparsingtest {
punkargs always
punkargs always
punkargs_by_id always
punkargs_by_id always
punkargs_parsecache always
punkargs_parsecache always
opt always
opt {optional opt}
argparse {optional argparse}
argparse {optional argparse}
cmdline_untyped unsupported
cmdline_untyped unsupported
cmdline_typed unsupported
cmdline_typed unsupported
@ -1494,6 +1507,8 @@ namespace eval argparsingtest::opts {
-join -type none -multiple 1
-join -type none -multiple 1
}]
}]
}
}
#tcl::OptProc DEFINES this proc, so skip the definition when opt is absent - see the optional-package requires at the module top
if {![catch {package present opt}]} {
tcl::OptProc opt {
tcl::OptProc opt {
{-return string "return type"}
{-return string "return type"}
{-frametype \uFFEF "type of frame"}
{-frametype \uFFEF "type of frame"}
@ -1513,6 +1528,7 @@ namespace eval argparsingtest::opts {
}
}
return $opts
return $opts
}
}
}
#cmdline::getoptions is much faster than typedGetoptions
#cmdline::getoptions is much faster than typedGetoptions
namespace eval argdoc {
namespace eval argdoc {
@ -1736,6 +1752,8 @@ namespace eval argparsingtest::opts {
-join -type none -multiple 1
-join -type none -multiple 1
}]
}]
}
}
#tepam::procedure DEFINES this proc, so skip the definition when tepam is absent - see the optional-package requires at the module top
if {![catch {package present tepam}]} {
tepam::procedure {tepam} {
tepam::procedure {tepam} {
-args {
-args {
{-return -type string -default string}
{-return -type string -default string}
@ -1753,6 +1771,7 @@ namespace eval argparsingtest::opts {
} {
} {
return [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]
return [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]
}
}
}
#*** !doctools
#*** !doctools
#[list_end] [comment {--- end definitions namespace argparsingtest::opts ---}]
#[list_end] [comment {--- end definitions namespace argparsingtest::opts ---}]
@ -1967,6 +1986,8 @@ namespace eval argparsingtest::tkstyle {
-join -type none -multiple 1
-join -type none -multiple 1
}]
}]
}
}
#tcl::OptProc DEFINES this proc, so skip the definition when opt is absent - see the optional-package requires at the module top
if {![catch {package present opt}]} {
tcl::OptProc opt {
tcl::OptProc opt {
{p1 -string "first positional argument"}
{p1 -string "first positional argument"}
{p2 -string "second positional argument"}
{p2 -string "second positional argument"}
@ -1990,6 +2011,7 @@ namespace eval argparsingtest::tkstyle {
}
}
return [list $p1 $p2 $opts]
return [list $p1 $p2 $opts]
}
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@ -2015,6 +2037,8 @@ namespace eval argparsingtest::tkstyle {
-join -type none -multiple 1
-join -type none -multiple 1
}]
}]
}
}
#tepam::procedure DEFINES this proc, so skip the definition when tepam is absent - see the optional-package requires at the module top
if {![catch {package present tepam}]} {
tepam::procedure {tepam} {
tepam::procedure {tepam} {
-named_arguments_first 0
-named_arguments_first 0
-args {
-args {
@ -2035,6 +2059,7 @@ namespace eval argparsingtest::tkstyle {
} {
} {
return [list $p1 $p2 [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]]
return [list $p1 $p2 [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]]
}
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@ -2296,6 +2321,8 @@ namespace eval argparsingtest::tclstyle {
p2 -type string -optional 0
p2 -type string -optional 0
}]
}]
}
}
#tcl::OptProc DEFINES this proc, so skip the definition when opt is absent - see the optional-package requires at the module top
if {![catch {package present opt}]} {
tcl::OptProc opt {
tcl::OptProc opt {
{-return string "return type"}
{-return string "return type"}
{-frametype \uFFEF "type of frame"}
{-frametype \uFFEF "type of frame"}
@ -2319,6 +2346,7 @@ namespace eval argparsingtest::tclstyle {
}
}
return [list $p1 $p2 $opts]
return [list $p1 $p2 $opts]
}
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@ -2439,6 +2467,8 @@ namespace eval argparsingtest::tclstyle {
p2 -type string -optional 0
p2 -type string -optional 0
}]
}]
}
}
#tepam::procedure DEFINES this proc, so skip the definition when tepam is absent - see the optional-package requires at the module top
if {![catch {package present tepam}]} {
tepam::procedure {tepam} {
tepam::procedure {tepam} {
-args {
-args {
{-return -type string -default string}
{-return -type string -default string}
@ -2458,6 +2488,7 @@ namespace eval argparsingtest::tclstyle {
} {
} {
return [list $p1 $p2 [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]]
return [list $p1 $p2 [dict create return $return frametype $frametype show_edge $show_edge show_seps $show_seps x $x y $y z $z 1 $1 2 $2 3 $3 join $join]]
}
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@ -2848,6 +2879,8 @@ namespace eval argparsingtest::sandwich {
p5 -type string -optional 0
p5 -type string -optional 0
}]
}]
}
}
#tcl::OptProc DEFINES this proc, so skip the definition when opt is absent - see the optional-package requires at the module top
if {![catch {package present opt}]} {
tcl::OptProc opt {
tcl::OptProc opt {
{p1 -string "first leading positional argument"}
{p1 -string "first leading positional argument"}
{p2 -string "second leading positional argument"}
{p2 -string "second leading positional argument"}
@ -2874,6 +2907,7 @@ namespace eval argparsingtest::sandwich {
}
}
return [list [list $p1 $p2] [list $p3 $p4 $p5] $opts]
return [list [list $p1 $p2] [list $p3 $p4 $p5] $opts]
}
}
}
namespace eval argdoc {
namespace eval argdoc {
lappend PUNKARGS [list {
lappend PUNKARGS [list {
@ -2985,7 +3019,7 @@ namespace eval ::punk::args::register {
package provide argparsingtest [namespace eval argparsingtest {
package provide argparsingtest [namespace eval argparsingtest {
variable pkg argparsingtest
variable pkg argparsingtest
variable version
variable version
set version 1.2 .0
set version 1.3 .0
}]
}]
return
return