Compare commits
2 Commits
ae2acc3d5f
...
7e50ef88f0
Author | SHA1 | Date |
---|---|---|
|
7e50ef88f0 | 1 week ago |
|
d6f9d3968e | 1 week ago |
17 changed files with 27652 additions and 164 deletions
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
||||
0.1.7 |
||||
0.1.8 |
||||
#First line must be a semantic version number |
||||
#all other lines are ignored. |
||||
|
@ -0,0 +1,309 @@
|
||||
# -*- tcl -*- |
||||
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt |
||||
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm |
||||
# |
||||
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem. |
||||
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository. |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# (C) 2025 |
||||
# |
||||
# @@ Meta Begin |
||||
# Application punk::args::tzint 999999.0a1.0 |
||||
# Meta platform tcl |
||||
# Meta license MIT |
||||
# @@ Meta End |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# doctools header |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
#*** !doctools |
||||
#[manpage_begin shellspy_module_punk::args::tzint 0 999999.0a1.0] |
||||
#[copyright "2025"] |
||||
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}] |
||||
#[moddesc {-}] [comment {-- Description at end of page heading --}] |
||||
#[require punk::args::tzint] |
||||
#[keywords module] |
||||
#[description] |
||||
#[para] - |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[section Overview] |
||||
#[para] overview of punk::args::tzint |
||||
#[subsection Concepts] |
||||
#[para] - |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Requirements |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[subsection dependencies] |
||||
#[para] packages used by punk::args::tzint |
||||
#[list_begin itemized] |
||||
|
||||
package require Tcl 8.6- |
||||
#*** !doctools |
||||
#[item] [package {Tcl 8.6}] |
||||
|
||||
# #package require frobz |
||||
# #*** !doctools |
||||
# #[item] [package {frobz}] |
||||
|
||||
#*** !doctools |
||||
#[list_end] |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[section API] |
||||
|
||||
|
||||
tcl::namespace::eval punk::args::tzint { |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# Base namespace |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
#*** !doctools |
||||
#[subsection {Namespace punk::args::tzint}] |
||||
#[para] Core API functions for punk::args::tzint |
||||
#[list_begin definitions] |
||||
|
||||
variable PUNKARGS |
||||
|
||||
namespace eval argdoc { |
||||
proc get_symbologies {} { |
||||
if {[catch { |
||||
package require tzint |
||||
::tzint::Encode symbologies |
||||
} result]} { |
||||
return |
||||
} else { |
||||
return $result |
||||
} |
||||
} |
||||
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- |
||||
lappend PUNKARGS [list { |
||||
@id -id ::tzint::Encode |
||||
@cmd -name "native tzint::Encode" -help\ |
||||
"" |
||||
@leaders -min 1 -max 1 |
||||
command -type string -choices {version symbologies bits eps svg xbm} |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "::tzint::Encode version" |
||||
@cmd -name "native tzint::Encode version" -help\ |
||||
"Return the version of underlying libzint" |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "::tzint::Encode symbologies" |
||||
@cmd -name "native tzint::Encode symbologies" -help\ |
||||
"Return a list of symbology names that can be encoded. |
||||
These are values that can be supplied for the -symbology flag" |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@dynamic |
||||
@id -id "::tzint::Encode svg" |
||||
@cmd -name "native tzint::Encode svg" |
||||
@leaders -min 2 -max 2 |
||||
#review - error msg for Encode without args is "Encode command ?name|varName data? ?-option value ...? |
||||
#This implies "varName data" is optional - but in practice it seems not to be (?) |
||||
"varName data" -type {string string} -optional 0 |
||||
@opts |
||||
-symbology -type string -choicerestricted 0 -choices {${[::punk::args::tzint::argdoc::get_symbologies]}} |
||||
-height -type integer -help\ |
||||
"The height of a 1d symbol" |
||||
-whitespace -type integer -help\ |
||||
"The amount of whitespace to the left and right of the generated barcode" |
||||
-bind -type boolean -default 0 -help\ |
||||
"tzint allows the symbol to be bound with 'boundary bars' |
||||
These bars help to prevent misreading of the symbol by corrupting |
||||
a scan if the scanning beam strays off the top or bottom of the symbol." |
||||
-box -type boolean -help\ |
||||
"Puts a border right around the symbol and its whitespace. |
||||
This option is automatically selected for ITF-14 symbols." |
||||
-border -type integer -help\ |
||||
"Specifies width of boundary or box." |
||||
-fg|-foreground -type string -default "000000" -help\ |
||||
"Foreground colour specified in RGB hexadecimal notation." |
||||
-bg|-background -type string -default "FFFFFF" -help\ |
||||
"Background colour specified in RGB hexadecimal notation." |
||||
-rotate -type integer -default 0 -choices {0 90 180 270} -help\ |
||||
"The symbol can be rotated through four orientations |
||||
by specifying one of the allowed angles of rotation." |
||||
-scale -type integer |
||||
-format -type string |
||||
-stat -type string -help\ |
||||
"variable name for status data" |
||||
#barcode specific options |
||||
#TODO - what? |
||||
-cols -type integer -help\ |
||||
"number of columns PDF417" |
||||
-vers -type integer -help\ |
||||
"option QR Code and Plessy" |
||||
-security -type integer -help\ |
||||
"error correction level PDF417 and QR Code" |
||||
-mode -type integer -help\ |
||||
"structured primary data mode Maxicode and Composite" |
||||
-primary -type string -help\ |
||||
"structured primary data Maxicode and Composite" |
||||
-notext -type boolean -help\ |
||||
"no interpretation line" |
||||
-square -type boolean -help\ |
||||
"force DataMatrix symbols to be square" |
||||
-init -type boolean -help\ |
||||
"create reader initialisation symbol Code128 and DataMatrix" |
||||
-smalltext -type boolean -help\ |
||||
"tiny interpretation line font" |
||||
#Changing the '0'/'1' character when using the bits command -- then -onchar and/or -offchar can be used |
||||
-onchar -type char |
||||
-offchar -type char |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@dynamic |
||||
@id -id "::tzint::Encode xbm" |
||||
@cmd -name "native tzint::Encode xbm" |
||||
${[punk::args::resolved_def -antiglobs {@id @cmd} "::tzint::Encode svg"]} |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
#*** !doctools |
||||
#[list_end] [comment {--- end definitions namespace punk::args::tzint ---}] |
||||
} |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# == === === === === === === === === === === === === === === |
||||
# Sample 'about' function with punk::args documentation |
||||
# == === === === === === === === === === === === === === === |
||||
tcl::namespace::eval punk::args::tzint { |
||||
tcl::namespace::export {[a-z]*} ;# Convention: export all lowercase |
||||
variable PUNKARGS |
||||
variable PUNKARGS_aliases |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "(package)punk::args::tzint" |
||||
@package -name "punk::args::tzint" -help\ |
||||
"Package |
||||
Description" |
||||
}] |
||||
|
||||
namespace eval argdoc { |
||||
#namespace for custom argument documentation |
||||
proc package_name {} { |
||||
return punk::args::tzint |
||||
} |
||||
proc about_topics {} { |
||||
#info commands results are returned in an arbitrary order (like array keys) |
||||
set topic_funs [info commands [namespace current]::get_topic_*] |
||||
set about_topics [list] |
||||
foreach f $topic_funs { |
||||
set tail [namespace tail $f] |
||||
lappend about_topics [string range $tail [string length get_topic_] end] |
||||
} |
||||
#Adjust this function or 'default_topics' if a different order is required |
||||
return [lsort $about_topics] |
||||
} |
||||
proc default_topics {} {return [list Description *]} |
||||
|
||||
# ------------------------------------------------------------- |
||||
# get_topic_ functions add more to auto-include in about topics |
||||
# ------------------------------------------------------------- |
||||
proc get_topic_Description {} { |
||||
punk::args::lib::tstr [string trim { |
||||
package punk::args::tzint |
||||
description to come.. |
||||
} \n] |
||||
} |
||||
proc get_topic_License {} { |
||||
return "MIT" |
||||
} |
||||
proc get_topic_Version {} { |
||||
return "$::punk::args::tzint::version" |
||||
} |
||||
proc get_topic_Contributors {} { |
||||
set authors {<unspecified>} |
||||
set contributors "" |
||||
foreach a $authors { |
||||
append contributors $a \n |
||||
} |
||||
if {[string index $contributors end] eq "\n"} { |
||||
set contributors [string range $contributors 0 end-1] |
||||
} |
||||
return $contributors |
||||
} |
||||
proc get_topic_custom-topic {} { |
||||
punk::args::lib::tstr -return string { |
||||
A custom |
||||
topic |
||||
etc |
||||
} |
||||
} |
||||
# ------------------------------------------------------------- |
||||
} |
||||
|
||||
# we re-use the argument definition from punk::args::standard_about and override some items |
||||
set overrides [dict create] |
||||
dict set overrides @id -id "::punk::args::tzint::about" |
||||
dict set overrides @cmd -name "punk::args::tzint::about" |
||||
dict set overrides @cmd -help [string trim [punk::args::lib::tstr { |
||||
About punk::args::tzint |
||||
documentation for tzint package |
||||
}] \n] |
||||
dict set overrides topic -choices [list {*}[punk::args::tzint::argdoc::about_topics] *] |
||||
dict set overrides topic -choicerestricted 1 |
||||
dict set overrides topic -default [punk::args::tzint::argdoc::default_topics] ;#if -default is present 'topic' will always appear in parsed 'values' dict |
||||
set newdef [punk::args::resolved_def -antiglobs -package_about_namespace -override $overrides ::punk::args::package::standard_about *] |
||||
lappend PUNKARGS [list $newdef] |
||||
proc about {args} { |
||||
package require punk::args |
||||
#standard_about accepts additional choices for topic - but we need to normalize any abbreviations to full topic name before passing on |
||||
set argd [punk::args::parse $args withid ::punk::args::tzint::about] |
||||
lassign [dict values $argd] _leaders opts values _received |
||||
punk::args::package::standard_about -package_about_namespace ::punk::args::tzint::argdoc {*}$opts {*}[dict get $values topic] |
||||
} |
||||
} |
||||
# end of sample 'about' function |
||||
# == === === === === === === === === === === === === === === |
||||
|
||||
|
||||
# ----------------------------------------------------------------------------- |
||||
# register namespace(s) to have PUNKARGS,PUNKARGS_aliases variables checked |
||||
# ----------------------------------------------------------------------------- |
||||
# variable PUNKARGS |
||||
# variable PUNKARGS_aliases |
||||
namespace eval ::punk::args::register { |
||||
#use fully qualified so 8.6 doesn't find existing var in global namespace |
||||
lappend ::punk::args::register::NAMESPACES ::punk::args::tzint ::punk::args::tzint::argdoc |
||||
} |
||||
# ----------------------------------------------------------------------------- |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Ready |
||||
package provide punk::args::tzint [tcl::namespace::eval punk::args::tzint { |
||||
variable pkg punk::args::tzint |
||||
variable version |
||||
set version 999999.0a1.0 |
||||
}] |
||||
return |
||||
|
||||
#*** !doctools |
||||
#[manpage_end] |
||||
|
@ -0,0 +1,3 @@
|
||||
1.1.1 |
||||
#First line must be a semantic version number |
||||
#all other lines are ignored. |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,309 @@
|
||||
# -*- tcl -*- |
||||
# Maintenance Instruction: leave the 999999.xxx.x as is and use punkshell 'dev make' or bin/punkmake to update from <pkg>-buildversion.txt |
||||
# module template: shellspy/src/decktemplates/vendor/punk/modules/template_module-0.0.3.tm |
||||
# |
||||
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem. |
||||
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository. |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# (C) 2025 |
||||
# |
||||
# @@ Meta Begin |
||||
# Application punk::args::tzint 1.1.1 |
||||
# Meta platform tcl |
||||
# Meta license MIT |
||||
# @@ Meta End |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# doctools header |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
#*** !doctools |
||||
#[manpage_begin shellspy_module_punk::args::tzint 0 1.1.1] |
||||
#[copyright "2025"] |
||||
#[titledesc {Module API}] [comment {-- Name section and table of contents description --}] |
||||
#[moddesc {-}] [comment {-- Description at end of page heading --}] |
||||
#[require punk::args::tzint] |
||||
#[keywords module] |
||||
#[description] |
||||
#[para] - |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[section Overview] |
||||
#[para] overview of punk::args::tzint |
||||
#[subsection Concepts] |
||||
#[para] - |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Requirements |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[subsection dependencies] |
||||
#[para] packages used by punk::args::tzint |
||||
#[list_begin itemized] |
||||
|
||||
package require Tcl 8.6- |
||||
#*** !doctools |
||||
#[item] [package {Tcl 8.6}] |
||||
|
||||
# #package require frobz |
||||
# #*** !doctools |
||||
# #[item] [package {frobz}] |
||||
|
||||
#*** !doctools |
||||
#[list_end] |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
#*** !doctools |
||||
#[section API] |
||||
|
||||
|
||||
tcl::namespace::eval punk::args::tzint { |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# Base namespace |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
#*** !doctools |
||||
#[subsection {Namespace punk::args::tzint}] |
||||
#[para] Core API functions for punk::args::tzint |
||||
#[list_begin definitions] |
||||
|
||||
variable PUNKARGS |
||||
|
||||
namespace eval argdoc { |
||||
proc get_symbologies {} { |
||||
if {[catch { |
||||
package require tzint |
||||
::tzint::Encode symbologies |
||||
} result]} { |
||||
return |
||||
} else { |
||||
return $result |
||||
} |
||||
} |
||||
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- |
||||
lappend PUNKARGS [list { |
||||
@id -id ::tzint::Encode |
||||
@cmd -name "native tzint::Encode" -help\ |
||||
"" |
||||
@leaders -min 1 -max 1 |
||||
command -type string -choices {version symbologies bits eps svg xbm} |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "::tzint::Encode version" |
||||
@cmd -name "native tzint::Encode version" -help\ |
||||
"Return the version of underlying libzint" |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "::tzint::Encode symbologies" |
||||
@cmd -name "native tzint::Encode symbologies" -help\ |
||||
"Return a list of symbology names that can be encoded. |
||||
These are values that can be supplied for the -symbology flag" |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@dynamic |
||||
@id -id "::tzint::Encode svg" |
||||
@cmd -name "native tzint::Encode svg" |
||||
@leaders -min 2 -max 2 |
||||
#review - error msg for Encode without args is "Encode command ?name|varName data? ?-option value ...? |
||||
#This implies "varName data" is optional - but in practice it seems not to be (?) |
||||
"varName data" -type {string string} -optional 0 |
||||
@opts |
||||
-symbology -type string -choicerestricted 0 -choices {${[::punk::args::tzint::argdoc::get_symbologies]}} |
||||
-height -type integer -help\ |
||||
"The height of a 1d symbol" |
||||
-whitespace -type integer -help\ |
||||
"The amount of whitespace to the left and right of the generated barcode" |
||||
-bind -type boolean -default 0 -help\ |
||||
"tzint allows the symbol to be bound with 'boundary bars' |
||||
These bars help to prevent misreading of the symbol by corrupting |
||||
a scan if the scanning beam strays off the top or bottom of the symbol." |
||||
-box -type boolean -help\ |
||||
"Puts a border right around the symbol and its whitespace. |
||||
This option is automatically selected for ITF-14 symbols." |
||||
-border -type integer -help\ |
||||
"Specifies width of boundary or box." |
||||
-fg|-foreground -type string -default "000000" -help\ |
||||
"Foreground colour specified in RGB hexadecimal notation." |
||||
-bg|-background -type string -default "FFFFFF" -help\ |
||||
"Background colour specified in RGB hexadecimal notation." |
||||
-rotate -type integer -default 0 -choices {0 90 180 270} -help\ |
||||
"The symbol can be rotated through four orientations |
||||
by specifying one of the allowed angles of rotation." |
||||
-scale -type integer |
||||
-format -type string |
||||
-stat -type string -help\ |
||||
"variable name for status data" |
||||
#barcode specific options |
||||
#TODO - what? |
||||
-cols -type integer -help\ |
||||
"number of columns PDF417" |
||||
-vers -type integer -help\ |
||||
"option QR Code and Plessy" |
||||
-security -type integer -help\ |
||||
"error correction level PDF417 and QR Code" |
||||
-mode -type integer -help\ |
||||
"structured primary data mode Maxicode and Composite" |
||||
-primary -type string -help\ |
||||
"structured primary data Maxicode and Composite" |
||||
-notext -type boolean -help\ |
||||
"no interpretation line" |
||||
-square -type boolean -help\ |
||||
"force DataMatrix symbols to be square" |
||||
-init -type boolean -help\ |
||||
"create reader initialisation symbol Code128 and DataMatrix" |
||||
-smalltext -type boolean -help\ |
||||
"tiny interpretation line font" |
||||
#Changing the '0'/'1' character when using the bits command -- then -onchar and/or -offchar can be used |
||||
-onchar -type char |
||||
-offchar -type char |
||||
@values -min 0 -max 0 |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
|
||||
lappend PUNKARGS [list { |
||||
@dynamic |
||||
@id -id "::tzint::Encode xbm" |
||||
@cmd -name "native tzint::Encode xbm" |
||||
${[punk::args::resolved_def -antiglobs {@id @cmd} "::tzint::Encode svg"]} |
||||
} "@doc -name Wikipage: -url {https://wiki.tcl-lang.org/page/tzint+%2D+tcl+package+for+libzint+barcode+encoding+library+%28no+Tk+needed%29}" ] |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
#*** !doctools |
||||
#[list_end] [comment {--- end definitions namespace punk::args::tzint ---}] |
||||
} |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# == === === === === === === === === === === === === === === |
||||
# Sample 'about' function with punk::args documentation |
||||
# == === === === === === === === === === === === === === === |
||||
tcl::namespace::eval punk::args::tzint { |
||||
tcl::namespace::export {[a-z]*} ;# Convention: export all lowercase |
||||
variable PUNKARGS |
||||
variable PUNKARGS_aliases |
||||
|
||||
lappend PUNKARGS [list { |
||||
@id -id "(package)punk::args::tzint" |
||||
@package -name "punk::args::tzint" -help\ |
||||
"Package |
||||
Description" |
||||
}] |
||||
|
||||
namespace eval argdoc { |
||||
#namespace for custom argument documentation |
||||
proc package_name {} { |
||||
return punk::args::tzint |
||||
} |
||||
proc about_topics {} { |
||||
#info commands results are returned in an arbitrary order (like array keys) |
||||
set topic_funs [info commands [namespace current]::get_topic_*] |
||||
set about_topics [list] |
||||
foreach f $topic_funs { |
||||
set tail [namespace tail $f] |
||||
lappend about_topics [string range $tail [string length get_topic_] end] |
||||
} |
||||
#Adjust this function or 'default_topics' if a different order is required |
||||
return [lsort $about_topics] |
||||
} |
||||
proc default_topics {} {return [list Description *]} |
||||
|
||||
# ------------------------------------------------------------- |
||||
# get_topic_ functions add more to auto-include in about topics |
||||
# ------------------------------------------------------------- |
||||
proc get_topic_Description {} { |
||||
punk::args::lib::tstr [string trim { |
||||
package punk::args::tzint |
||||
description to come.. |
||||
} \n] |
||||
} |
||||
proc get_topic_License {} { |
||||
return "MIT" |
||||
} |
||||
proc get_topic_Version {} { |
||||
return "$::punk::args::tzint::version" |
||||
} |
||||
proc get_topic_Contributors {} { |
||||
set authors {<unspecified>} |
||||
set contributors "" |
||||
foreach a $authors { |
||||
append contributors $a \n |
||||
} |
||||
if {[string index $contributors end] eq "\n"} { |
||||
set contributors [string range $contributors 0 end-1] |
||||
} |
||||
return $contributors |
||||
} |
||||
proc get_topic_custom-topic {} { |
||||
punk::args::lib::tstr -return string { |
||||
A custom |
||||
topic |
||||
etc |
||||
} |
||||
} |
||||
# ------------------------------------------------------------- |
||||
} |
||||
|
||||
# we re-use the argument definition from punk::args::standard_about and override some items |
||||
set overrides [dict create] |
||||
dict set overrides @id -id "::punk::args::tzint::about" |
||||
dict set overrides @cmd -name "punk::args::tzint::about" |
||||
dict set overrides @cmd -help [string trim [punk::args::lib::tstr { |
||||
About punk::args::tzint |
||||
documentation for tzint package |
||||
}] \n] |
||||
dict set overrides topic -choices [list {*}[punk::args::tzint::argdoc::about_topics] *] |
||||
dict set overrides topic -choicerestricted 1 |
||||
dict set overrides topic -default [punk::args::tzint::argdoc::default_topics] ;#if -default is present 'topic' will always appear in parsed 'values' dict |
||||
set newdef [punk::args::resolved_def -antiglobs -package_about_namespace -override $overrides ::punk::args::package::standard_about *] |
||||
lappend PUNKARGS [list $newdef] |
||||
proc about {args} { |
||||
package require punk::args |
||||
#standard_about accepts additional choices for topic - but we need to normalize any abbreviations to full topic name before passing on |
||||
set argd [punk::args::parse $args withid ::punk::args::tzint::about] |
||||
lassign [dict values $argd] _leaders opts values _received |
||||
punk::args::package::standard_about -package_about_namespace ::punk::args::tzint::argdoc {*}$opts {*}[dict get $values topic] |
||||
} |
||||
} |
||||
# end of sample 'about' function |
||||
# == === === === === === === === === === === === === === === |
||||
|
||||
|
||||
# ----------------------------------------------------------------------------- |
||||
# register namespace(s) to have PUNKARGS,PUNKARGS_aliases variables checked |
||||
# ----------------------------------------------------------------------------- |
||||
# variable PUNKARGS |
||||
# variable PUNKARGS_aliases |
||||
namespace eval ::punk::args::register { |
||||
#use fully qualified so 8.6 doesn't find existing var in global namespace |
||||
lappend ::punk::args::register::NAMESPACES ::punk::args::tzint ::punk::args::tzint::argdoc |
||||
} |
||||
# ----------------------------------------------------------------------------- |
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Ready |
||||
package provide punk::args::tzint [tcl::namespace::eval punk::args::tzint { |
||||
variable pkg punk::args::tzint |
||||
variable version |
||||
set version 1.1.1 |
||||
}] |
||||
return |
||||
|
||||
#*** !doctools |
||||
#[manpage_end] |
||||
|
Binary file not shown.
Loading…
Reference in new issue