'''dgtools::argvparse''' Command line parsing package similar to the spirit of Pythons argparse - https://docs.python.org/3/library/argparse.html * Homepage: https://chiselapp.com/user/dgroth/repository/tclcode/index * Download: https://chiselapp.com/user/dgroth/repository/tclcode/download * Manual: https://chiselapp.com/user/dgroth/repository/tclcode/doc/tip/dgtools/argvparse.html '''Example''' ====== package require dgtools::argvparse # simulate: tclsh script.tcl --filename test.txt -v 1 -h # on the terminal by manually setting argv set argv [list --filename test.txt -v 1 -h] proc mproc {args} { puts "proc mproc is executed with args $args" } set ap [::dgtools::argvparse %AUTO% -appname "Test Application" \ -author "Detlef Groth" -usage "-f filename ?-t -m -v number -h?"] $ap argument -f --filename "filename (input file)" -required true $ap argument -t --test "(test flag)" -boolean true $ap argument -m --mproc "(execute procedure mproc)" -script mproc $ap argument -v --verbosity "number (specifying verbosity, values from 0 to 5)" \ -type integer -default 0 set res [$ap parse $argv] ====== If this script is executed using the -h or --help option it gives the following help message: =============================== Test Application - Detlef Groth =============================== Usage: argvparse.tcl -f filename ?-t -m -v number -h? Mandatory arguments: -f, --filename filename (input file) Optional arguments: -h, --help (show this help page) -m, --mproc (execute procedure mproc) -t, --test (test flag) -v, --verbosity number (specifying verbosity, values from 0 to 5) ---- <> Command | Argument Processing | Snit