{"id":28283558,"url":"https://github.com/georgtree/argparse","last_synced_at":"2026-02-03T21:31:50.956Z","repository":{"id":291470586,"uuid":"954889941","full_name":"georgtree/argparse","owner":"georgtree","description":"Argument preprocessor for Tcl","archived":false,"fork":false,"pushed_at":"2025-08-23T00:21:00.000Z","size":711,"stargazers_count":5,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T02:42:32.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Roff","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/georgtree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-25T19:18:13.000Z","updated_at":"2025-08-23T00:21:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"1aba45d7-c008-4ff3-89ac-15905d4e7264","html_url":"https://github.com/georgtree/argparse","commit_stats":null,"previous_names":["georgtree/argparse"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/georgtree/argparse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgtree%2Fargparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgtree%2Fargparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgtree%2Fargparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgtree%2Fargparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georgtree","download_url":"https://codeload.github.com/georgtree/argparse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgtree%2Fargparse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29058264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T20:13:53.544Z","status":"ssl_error","status_checked_at":"2026-02-03T20:13:40.507Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-21T16:15:32.386Z","updated_at":"2026-02-03T21:31:50.950Z","avatar_url":"https://github.com/georgtree.png","language":"Roff","funding_links":[],"categories":[],"sub_categories":[],"readme":"# argparse\n\nThis is a fork of argparse project initially developed by Andy Goth \u003candrew.m.goth@gmail.com\u003e.\n\nSee [original repository](https://core.tcl-lang.org/tcllib/timeline?r=amg-argparse), and \n[wiki page](https://wiki.tcl-lang.org/page/argparse).\n\nStarting from 0.6 version, the base implementation is in C. Tcl-only version is still availible and will be availible\nin future with the same feature set. C version in order of magnitude faster than Tcl-only version due to cashing of\nthe parsed once argument definition.\n\n## Installation\n\nYou have two ways: install from git repo (convinient for Linux users) or from archive package release.\n\nAdditionaly, package was added into \"batteries included\" Magicsplat \n[distribution](https://www.magicsplat.com/tcl-installer/index.html#packages) of Tcl8.6 and Tcl9.0.\n\n### From git repo\n\nTo install default C implementation, run following commands:\n- `git clone https://github.com/georgtree/argparse.git`\n- `./configure`\n- `sudo make install`\n\nDuring installation manpages are also installed.\n\nFor test package in place run `make test`.\n\nFor package uninstall run `sudo make uninstall`.\n\nTo install Tcl-only version, the sequence is the same, except the flag `--enable-tcl-only` provided to `./configure`\nscript.\n\n### From archive\n\nTo install the package you should extract archive with source code and add path of the package folder to `auto_path`\nvariable:\n```tcl\nlappend auto_path \"path to argparse package\"\npackage require argparse\n```\n\nThere are two pre-compiled version: for Linux x86-64 and for Windows x86-64 UCRT. Both archives provide C and Tcl-only\nversions, you can select the version you need in `pkgIndex.tcl` by conditional statement.\n\n## Table of content\n\n  - [Table of content](#table-of-content)\n  - [Synopsys](#synopsys)\n  - [Description](#description)\n  - [Quick Start](#quick-start)\n  - [Concepts](#concepts)\n    - [Argument](#argument)\n    - [Definition](#definition)\n    - [Global Switch](#global-switch)\n    - [Element](#element)\n    - [Element Switch](#element-switch)\n    - [Name](#name)\n    - [Key](#key)\n    - [Switch](#switch)\n    - [Parameter](#parameter)\n    - [Value](#value)\n    - [Alias](#alias)\n    - [Shorthand flag](#shorthand-flag)\n    - [Comment](#comment)\n  - [Global Switches](#global-switches)\n  - [Element Switches](#element-switches)\n  - [Collecting unassigned arguments](#collecting-unassigned-arguments)\n  - [Default values](#default-values)\n  - [Validation](#validation)\n  - [Forbid](#forbid)\n  - [Allow](#allow)\n  - [Reciprocal](#reciprocal)\n  - [Imply](#imply)\n  - [Passthrough and normalization](#passthrough-and-normalization)\n  - [Upvar Elements](#upvar-elements)\n  - [Template](#template)\n  - [Help](#help)\n  - [Argument Processing Sequence](#argument-processing-sequence)\n    - [Normal processing](#normal-processing)\n    - [Processing with parameters first](#processing-with-parameters-first)\n    - [Processing with mixed](#processing-with-mixed)\n  - [Return Value](#return-value)\n  - [Author(s)](#author(s))\n\n\n\n## Synopsys\n\n``` text\npackage require Tcl 8.6-\npackage require textutil::adjust\nargparse ?-globalSwitch ...? ?--? definition ?arguments?\n```\n\n## Description\n\nThe `argparse` package provides a powerful argument parser command named `argparse` capable of flexibly processing and\nvalidating many varieties of switches and parameters.\n\nTcl commands requiring more advanced argument parsing than provided by the standard `proc` command can be declared to\naccept `args` (i.e. any number of arguments), then can call `argparse` to perform the real argument parsing.\n\nIn addition to Tcl command argument parsing, `argparse` is suitable for command line argument parsing, operating on the\nvalue of the `::argv` global variable. To use it with `argparse`, you should provide `argv` as an argument to procedure\nafter definition.\n\n`argparse` may be applied to a variety of special purposes beyond standard argument parsing. For example, `argparse` can\nparse custom variadic data structures formatted as lists of switches and/or parameters of a highly dynamic nature.\nAnother example: by calling `argparse` multiple times, it is possible to parse nested or multi-part argument lists in\nwhich arguments to subsystems are embedded in passthrough switches or parameters.\n\n## Quick Start\n\nThe `argparse` command may have many complex features, but it is not necessary to understand it in depth before using it\nfor the most common tasks. Its syntax is reasonably intuitive, so the best thing to do is see it in action before\nreading the precise details on how it works.\n\nConsider the following:\n\n```tcl\npackage require argparse\nproc greet {args} {\n    argparse {\n        {-salutation= -default hello}\n        -modifier=\n        -title\n        subject\n    }\n    set msg $salutation\n    if {[info exists title]} {\n        set msg [string totitle $msg]\n    }\n    if {[info exists modifier]} {\n        append msg \", \" $modifier\n    }\n    append msg \" \" $subject\n}\n```\n\nThis example demonstrates many of the argparse core concepts and features. The greet command is defined to accept args.\nWhen not explicitly given an argument list to parse, argparse parses the value of the args variable and stores the\nresults into local variables having the same [names](#name) as the various [elements](#element) of the\n[definition](#definition).\n\nHere, the definition is a list of four elements, named `salutation`, `modifier`, `title`, and `subject`. Because their\nnames are prefixed with `-`, `salutation`, `modifier`, and `title` are [switches](#switch), whereas `subject`, lacking a\n`-` prefix, is a [parameter](#parameter). Two of the switches are given a `=` suffix, which means they each take an\n[argument](#argument), whereas `title` does not. In addition to these [flag](#flag) characters, the `salutation` element\nis surrounded with braces because it contains more list words used to further customize how it is handled. Namely, it\nuses the `-default` [element switch](#element-switches) to set its default value to `hello`, in case `-salutation` is\nnot present in the argument list.\n\nBy default, switches are [optional](#optional) and parameters are [required](#required). `salutation`, `modifier`, and\n`title`, being switches, are all optional, but since `salutation` has a default value, its variable's existence is\ntherefore guaranteed. Likewise, `subject`, being a parameter, is required, and its variable's existence is also\nguaranteed. On the contrary, because `modifier` and `title` are optional and have no default value, it is necessary to\nuse `info exists` to confirm their variables' existence before attempting to read them. Because `title` does not accept\nan argument, its variable's value (if the variable exists at all) is predefined to be empty string.\n\n```tcl\ngreet world\n```\n```text\n==\u003e hello world\n```\n\nThe first time `greet` is called, it is given only one argument, which is bound to the `subject` parameter. Normally,\nswitch arguments appear to the left of parameter arguments, and parameter arguments are bound first. Thus, the final\nargument to `greet` is always bound to the `subject` parameter, even if it happens to resemble a switch, and is\ntherefore stored in the `subject` variable. Because their associated switches do not appear in the argument list, the\n`salutation` variable is set to its default value (`hello`), and the `modifier` and `title` variables are unset due to\nlacking a default.\n\n```tcl\ngreet -salutation howdy world\n```\n```text\n==\u003e howdy world\n```\n\nThe second time `greet` is called, it is given three arguments. As discussed above, the final argument (`world`) is\nimmediately stored into the `subject` variable before any switch processing occurs. Next, the remaining two arguments\nare examined and determined to be the name and value of the `salutation` switch. Thus, the second argument (`howdy`) is\nstored in the `salutation` variable. The `modifier` and `title` variables are unset.\n\n```tcl\ngreet -title -mod \"my dear\" world\n```\n```text\n==\u003e Hello, my dear world\n```\n\nThe third time `greet` is called, it is given four arguments. The first is `-title`, causing the title variable to be\nset to empty string. The second is the name of the `modifier` switch. More precisely, it is an unambiguous prefix\nthereof, i.e. an abbreviation. This causes the third argument (`my dear`) to be stored in the `modifier` variable, and\nthe final argument (`world`) is stored in the `subject` variable. As for the `salutation` variable, it is set to its\ndefault (`hello`).\n\n```tcl\ngreet -title\n```\n```text\n==\u003e hello -title\n```\n\nThe fourth time `greet` is called, it is given one argument. Because the final argument is always bound to the `subject`\nparameter, `subject` is set to `-title` even though there happens to be a switch with the same name. There are no\nremaining arguments, so the switches are all handled according to defaults, just like in the first call to `greet`.\n\n## Concepts\n\nThis section lists and explains the concepts and terminology employed by the `argparse` package. The concepts are\nnumerous and interrelated, so it may be necessary to read this section multiple times and to refer back to it while\nreading the remainder of this document.\n\n### Argument\n\nThe actual values passed to the `argparse` command to be parsed are known as arguments. There are two ways of providing\narguments - via local variable `args` of current scope procedure, or explicitly as an argument after `definition`.\n\n### Definition\n\nThe *definition* determines how the `argparse` command parses its arguments. Definitions are Tcl lists of any length,\neach word of which is an [element](#element). Each definition contains a unique, non-empty name element consisting of\nalphanumerics, underscores, and minus (not as the first character), then zero or more of the [element\nswitches](#element-switch)\n\nThe following example definition may conceivably be used by a command that stores a sequence of numbers into a variable.\n\n``` tcl\n{\n    # {Optional sequence control switches}\n    {-from= -default 1}\n    {-to=   -default 10}\n    {-step= -default 1}\n    # {Required output list variable}\n    listVar^\n}\n```\n\nThe example of such procedure is [source](https://stackoverflow.com/a/38436286/21306711):\n\n```tcl\nproc genNums {args} {\n    argparse {\n        # {Optional sequence control switches}\n        {-from= -default 1}\n        {-to=   -default 10}\n        {-step= -default 1}\n        {-prec= -default 1}\n        # {Required output list variable}\n        listVar^\n    }\n    if {$step \u003c 0} {\n        set op ::tcl::mathop::\u003e\n    } else {\n        set op ::tcl::mathop::\u003c\n    }\n    for {set n $from} {[$op $n $to]} {set n [expr {$n + $step}]} {\n        lappend listVar [format %.*f $prec $n]\n    }\n}\ngenNums -from 0 -to 10 -step 2 sequenceVar\nputs $sequenceVar\n```\n```text\n0.0 2.0 4.0 6.0 8.0\n```\n\nIn this example procedure definition `{-prec= -default 1}` is added and defines precision of resulted sequence of\nnumbers. Instead of returning value via `[return]` command we save resulted list directly in variable of caller scope\n`sequenceVar`.\n\n### Global Switch\n\nA *global switch* configures the overall operation of the `argparse` command. Global switches are optional initial\narguments to `argparse` and may only appear before the [definition](#definition) argument. Global switches may also be\nembedded within special definition [elements](#element) whose [name](#name) is empty string.\n\n### Element\n\nA [definition](#definition) contains any number of *elements*. For the most part, each element defines either a\n[switch](#switch) or a [parameter](#parameter). Elements may also be [comments](#comment) or [global\nswitches](#global-switches). An element is itself a Tcl list whose required first word is the name (with optional\nshorthand aliases and flags) and whose optional subsequent words are element switches.\n\nIn addition to [switches](#switch) and [parameters](#parameter), elements may be [comments](#comment) or lists of \n[global switches](#global-switches).\n\nThe example definition shown above contains one parameter element, three switch elements, two comment elements, and no \nglobal switches. All switch and parameter elements in the example make use of shorthand flags.\n\nOne element from the above example is repeated here so it may be examined more closely.\n\n``` tcl\n{-from= -default 1}\n```\n\nThe name of this element is from. It uses the `-` and `=` flags, as well as the `-default` element switch with argument \n`1`. The specific meaning of flags and element switches are described elsewhere in this document.\n\n### Element Switch\n\nAn *element switch* configures a single [element](#element) in the [definition](#definition). Element switches are \nlisted following the [name](#name) word of the definition element.\n\nIn the above example definition, each [switch](#switch) element explicitly uses the `-default` element switch. Due to \nuse of the `-` and `=` shorthand [flags](#flag), each switch element also implicitly uses the `-switch` and `-argument`\nelement switches.\n\n### Name\n\nAside from [aliases](#alias) and [flags](#flag), the first word of each [switch](#switch) or [parameter](#parameter) \n[element](#element) in the [definition](#definition) is the *name*.\n\nSwitch and parameter element names may not be used more than once within a definition.\n\nIf the name is `#`, the element is a [comment](#comment) and is ignored. If the name is empty string, the element is \nneither a switch nor a parameter and is instead a list of [global switches](#global-switches).\n\n### Key\n\nIn addition to having a [name](#name), every [switch](#switch) and [parameter](#parameter) [definition](#definition) \n[element](#element) has a key. Unlike names, multiple elements may share the same key, subject to restrictions.\n\nBy default, the key defaults to the name, but it is possible to use the `-key` [element switch](#element-switch) to \nexplicitly declare an element's key.\n\nKeys determine the variable names or dict keys `argparse` uses to return the argument value of the switch or parameter.\n\nMultiple elements may share the same `-key` value if they are switches, do not use `-argument` or `-catchall`, and do\nnot use `-default` for more than one element. Such elements are automatically are given `-forbid` constraints to prevent\nthem from being used simultaneously.  If such an element does not use `-boolean` or `-value`, the element name is used\nas its default `-value`.\n\n### Switch\n\nSwitch is the optional element, that could be made mandatory with `-required` [element switch](#element-switch). \nIt could be defined either with shorthand `-` before name or with `-switch` [element switch](#element-switch).\n\nUnambiguous prefixes of switch names are acceptable, unless the `-exact` switch is used. Switches in the argument list\nnormally begin with a single `-` but can also begin with `--` if the `-long` switch is used. Arguments to switches\nnormally appear as the list element following the switch, but if `-equalarg` is used, they may be supplied within the\nswitch element itself, delimited with an `=` character, e.g. `-switch=arg`.\n\nWhen `-switch` and `-optional` are both used, `-catchall`, `-default`, and `-upvar` are disallowed.\n\n### Parameter\n\nParameter is the mandatory [element](#element) that is provided without any preceding flags before name, and it's\nposition in the list of [definitions](#definition) is the same as it must be passed to `argparse` procedure.\n\nIn definition list it is also could be explicitly stated with `-parameter` [element switch](#element-switch). Parameters\ncan be made optional with `-optional`. `-catchall` also makes parameters optional, unless `-required` is used, in which\ncase at least one argument must be assigned to the parameter. Otherwise, using `-required` with `-parameter` has no\neffect.\n\n### Value\n\nValue is the argument that is passed into variable (or dictionary value) for particular [parameter](#parameter) or\n[switch](#switch) if it is defined with `-argument` or shorthand `=` after switch name. `-optional`, `-required`,\n`-catchall`, and `-upvar` imply `-argument` when used with `-switch`.  Consequently, switches require an argument when\nany of the [shorthand flag](#shorthand-flag) characters are used, and it is not necessary to explicitly specify `=` if\nany of the other flag characters are used.\n\nIf `-argument` is used, the value assigned to the switch's [key](#key) is normally the next argument following the\nswitch.  With `-catchall`, the value assigned to the switch's key is instead the list of all remaining arguments. With\n`-optional`, the following processing is applied:\n\n - If the switch is not present, the switch's key is omitted from the result.\n - If the switch is not the final argument, its value is a two-element list\n  consisting of empty string and the argument following the switch.\n - If the switch is the final argument, its value is empty string.\n\nWe can also explicitly specify particular value which is assigned to switch key whet switch is presented is present with\n`-value` after switch name in [definition](#definition).\n\n`-value` may not be used with `-argument`, `-optional`, `-required`, or `-catchall`. `-value` normally defaults to \nempty string, except when `-boolean` is used (1 is the default `-value`) or multiple switches share the same `-key` (the\nelement name is the default `-value`).\n\n### Alias\n\nAlias is the alternative [name](#name) of the [switch](#switch) element. It can be provided by `-alias ALIAS` element \nswitch, or before the base name with `|` shorthand flag, but after `-` flag. For example:\n\n``` tcl\n{-variable= -alias var -required}\n```\n\nor\n\n``` tcl\n{-var|variable= -required}\n```\n\nAlso supported multiple aliases for single switch, for example:\n\n``` tcl\n{-variable= -alias {var v} -required}\n```\n\nor\n\n``` tcl\n{-var|v|variable= -required}\n```\n\nThe name of the element is the last name in the list of aliases, if it is provided via shorhand syntax.\n\n### Shorthand flag\n\nIf neither `-switch` nor `-parameter` are used, a shorthand flag form is permitted. If the [name](#name) is preceded by\n`-`, it is a [switch](#switch); otherwise, it is a [parameter](#parameter). An alias may be written after `-`, then\nfollowed by `|` and the switch name.\n\nThe element name may be followed by any number of flag characters:\n\n| Shorthand flag | Description                                  |\n|:---------------|:---------------------------------------------|\n| `=`            | Same as `-argument`; only valid for switches |\n| `?`            | Same as `-optional`                          |\n| `!`            | Same as `-required`                          |\n| `*`            | Same as `-catchall`                          |\n| `^`            | Same as `-upvar`                             |\n\n\n### Comment\n\nComment is the [element](#element) started with `#` at the start of definition in the definition list.\n\n\n## Global Switches\n\n| Switch                     | Description                                                                              |\n|:---------------------------|:-----------------------------------------------------------------------------------------|\n| `-inline`                  | Return the result dict rather than setting caller variables                              |\n| `-exact`                   | Require exact switch name matches, and do not accept prefixes                            |\n| `-mixed`                   | Allow switches to appear after parameters                                                |\n| `-pfirst`                  | Set required parameters to appear before switches; conflicts with `-mixed`               |\n| `-long`                    | Recognize `--switch` long option alternative syntax                                      |\n| `-equalarg`                | Recognize `-switch=arg` inline argument alternative syntax                               |\n| `-normalize`               | Normalize switch syntax in passthrough result keys                                       |\n| `-reciprocal`              | Every element's `-require` constraints are reciprocal                                    |\n| `-level levelSpec`         | Every `-upvar` element's `[upvar]` level; defaults to 1                                  |\n| `-template templateString` | Transform default element names using a substitution template                            |\n| `-pass passKey`            | Pass unrecognized elements through to a result key                                       |\n| `-keep`                    | Do not unset omitted element variables; conflicts with `-inline`                         |\n| `-boolean`                 | Treat switches as having `-boolean` wherever possible                                    |\n| `-validate validDef`       | Define named validation expressions to be used by elements                               |\n| `-enum enumDef`            | Define named enumeration lists to be used by elements                                    |\n| `-help description`        | Enable help message generating when -help argument is provided                           |\n| `-helplevel value`         | Set -level option for return command in help evaluation                                  |\n| `-helpret`                 | Set to return help message as a return value of procedure instead of putting into stdout |\n| `--`                       | Force next argument to be interpreted as the definition list                             |\n\n## Element Switches\n\n| Switch                     | Description                                                                             |\n|:---------------------------|:----------------------------------------------------------------------------------------|\n| `-switch`                  | Element is a switch; conflicts with `-parameter`                                        |\n| `-parameter`               | Element is a parameter; conflicts with `-switch`                                        |\n| `-alias aliasName`         | Alias names; requires `-switch`                                                          |\n| `-ignore`                  | Element is omitted from result; conflicts with `-key` and `-pass`                       |\n| `-key keyName`             | Override key name; not affected by `-template`                                          |\n| `-pass keyName`            | Pass through to result key; not affected by `-template`                                 |\n| `-default value`           | Value if omitted; conflicts with `-required` and `-keep`                                |\n| `-keep`                    | Do not unset if omitted; requires `-optional`; conflicts `-inline`                      |\n| `-value value`             | Value if present; requires `-switch`; conflicts with `-argument`                        |\n| `-boolean`                 | Equivalent to `-default 0 -value 1`                                                     |\n| `-argument`                | Value is next argument following switch; requires `-switch`                             |\n| `-optional`                | Switch value is optional, or parameter is optional                                      |\n| `-required`                | Switch is required, or stop `-catchall` from implying `-optional`                       |\n| `-catchall`                | Value is list of all otherwise unassigned arguments                                     |\n| `-upvar`                   | Links caller variable; conflicts with `-inline` and `-catchall`                         |\n| `-level levelSpec`         | This element's `[upvar]` level; requires `-upvar`                                       |\n| `-standalone`              | If element is present, ignore `-required`, `-require`, `-forbid` and `-allow`           |\n| `-require nameList`        | If element is present, other elements that must be present                              |\n| `-forbid nameList`         | If element is present, other elements that must not be present                          |\n| `-allow nameList`          | If element is present, other elements that is not in the `nameList` must not be present |\n| `-imply argList`           | If element is present, extra switch arguments; requires `-switch`                       |\n| `-reciprocal`              | This element's `-require` is reciprocal; requires `-require`                            |\n| `-validate validNameOrDef` | Name of validation expression, or inline validation definition                          |\n| `-errormsg message`        | Custom error message that replaces the default one; requires `-validate`                |\n| `-enum enumNameOrDef`      | Name of enumeration list, or inline enumeration definition                              |\n| `-type typeName`           | Validate value according to type defined in [string is] command, requires `-argument`   |\n| `-help description`        | Provide description to element that is displayed when help message is generated         |\n| `-hsuppress`               | Suppress help generation for certain element                                            |\n\n## Collecting unassigned arguments\n\nWith `-catchall` [element switch](#element-switch), we can collects the rest of otherwise unassigned \n[arguments](#argument) to list and save to switch's [key](#key). Let's consider next example:\n\n```tcl\nproc applyOperator {args} {\n    argparse {\n        {-op= -enum {+ *}}\n        {-elements= -catchall}\n    }\n    set result [lindex $elements 0]\n    foreach element [lrange $elements 1 end] {\n        set result [::tcl::mathop::$op $result $element]\n    }\n    return $result\n}\n\napplyOperator -op * -elements 1 2 3 4 5\n```\n```text\n==\u003e 120\n```\n\nThis procedure make summation or product of all arguments passed after `-elements` switch with `-catchall` element\nswitch. There is also an example of using `-enum` switch to [validate](#validation) possible values of argument to `-op`\nswitch.\n\nAt most one parameter may use `-catchall`.\n\n## Default values\n\n[Element switch](#element-switch) `-default` specifies the [value](#value) to assign to [element](#element)\n[keys](#key) when the element is omitted. If `-default` is not used, keys for omitted [switches](#switch) and\n[parameters](#parameter) are omitted from the result, unless `-catchall` is used, in which case the default value for\n`-default` is empty string.\n\n## Validation\n\n`-validate` and `-enum` provide [element](#element) [value](#value) validation.  The global `-validate` and `-enum`\n[switches](#global-switch) declare named validation expressions and enumeration lists, and the per-element `-validate`\nand `-enum` switches select which validation expressions and enumeration lists are used on which elements.  The argument\nto the global `-validate` and `-enum` switches is a dict mapping from validation or enumeration name to validation\nexpressions or enumeration lists. The argument to a per-element `-validate` switch is a validation name or expression,\nand the argument to a per-element `-enum` switch is an enumeration name or list.  An element may not use both\n`-validate` and `-enum`.\n\nA validation expression is an `[expr]` expression parameterized on a variable named `arg` which is replaced with the \n[argument](#argument). If the expression evaluates to `true`, the argument is accepted. Let's consider the example:\n\n```tcl\nproc exponentiation {args} {\n    argparse {\n        {-b!= -validate {[string is double $arg]}}\n        {-n!= -validate {[string is double $arg]}}\n    }\n    return [expr {$b**$n}]\n}\n\nexponentiation -b 2 -n 4\n```\n```text\n==\u003e 16\n```\n\nThis simple function return exponentiation of number `b` in `n`. Our simple tests verify that the arguments are strings\nthat could be considered as floating numbers, and only after that set the corresponding variables.\n\nIf wrong string is provided, a error message appears:\n\n```tcl\nexponentiation -b a -n 4\n```\n```{tclerr}\n-b value \"a\" fails validation: [string is double $arg]\n```\n\n\nAn enumeration list is a list of possible argument values. If the argument appears in the enumeration list, the \nargument is accepted. Unless `-exact` is used, if the argument is a prefix of exactly one element of the enumeration \nlist, the argument is replaced with the enumeration list element.\n\nAdditional built-in validation of argument is done with help of [string is] command. All types (classes) are supported\nexcept `true` and `false` class. To declare type of argument, the switch `-type` should be provided to definition of\nswitch or parameter with one of the argument: `alnum alpha ascii boolean control dict digit double graph integer list\nlower print punct space upper wideinteger wordchar xdigit`. If you specify type for switch, the switch should be defined\nwith `-argument` (or `=` [shorthand](#shorthand-flag)). Conflicts with `-upvar`, `-boolean` and `-enum`, combination of\n`-switch`, `-optional` and `type` is forbidden.\n\nAs an example, we can use previously proposed procedure:\n\n```tcl\nproc genNums {args} {\n    argparse {\n        # {Optional sequence control switches}\n        {-from= -default 1 -type double}\n        {-to=   -default 10 -type double}\n        {-step= -default 1 -type double}\n        {-prec= -default 1 -type double}\n        # {Required output list variable}\n        listVar^\n    }\n    if {$step \u003c 0} {\n        set op ::tcl::mathop::\u003e\n    } else {\n        set op ::tcl::mathop::\u003c\n    }\n    for {set n $from} {[$op $n $to]} {set n [expr {$n + $step}]} {\n        lappend listVar [format %.*f $prec $n]\n    }\n}\n```\n\nIf we provide the wrong argument type to `genNums` procedure, the error occurs:\n\n```tcl\ngenNums -from 0 -to 10.. -step 2 sequenceVar\n```\n```{tclerr}\n-to value \"10..\" is not of the type double\n```\n\n\nFor `-validation` switch the custom error message could be provided by element switch `-errormsg`. For substitution,\n`arg` and `name` variables are availible, as well as internal dictionary `opt` that contains processed definition of \nelement. For example, the previously defined procedure could be rewritted with custom error messages:\n```tcl\nproc exponentiation {args} {\n    argparse {\n        {-b!= -validate {[string is double $arg]} -errormsg {Value of switch '$name' must be double,\\\n                                                                '$arg' was provided}}\n        {-n!= -validate {[string is double $arg]} -errormsg {Value of switch '$name' must be double,\\\n                                                                '$arg' was provided}}\n    }\n    return [expr {$b**$n}]\n}\n\nexponentiation -b 2 -n 4t\n```\n```{tclerr}\nValue of switch '-n' must be double, '4t' was provided\n```\n\n\n## Forbid\n\nIf the presence of an [element](#element) should be forbidden in combination with certain other elements, use the\n`-forbid` [switch](#element-switch) followed by a list of element names. In next example, we can forbid using\narguments that logically incompatible:\n\n```tcl\nproc sheduleEvent {args} {\n    set arguments [argparse -inline\\\n            -validate [dict create date {[regexp {^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\\d{4}$} $arg]}\\\n                time {[regexp {^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$} $arg]}] {\n        {date -validate date}\n        {time -validate time}\n        {-allday -forbid {duration endtime}}\n        {-duration= -forbid {allday endtime} -validate time}\n        {-endtime= -forbid {allday duration} -validate time}\n    }]\n    if {![dict exists $arguments allday] \u0026\u0026 ![dict exists $arguments duration] \u0026\u0026 ![dict exists $arguments endtime]} {\n        return -code error \"One of the switch must be presented: -allday, -duration or -endtime\"\n    }\n    return $arguments\n}\n```\n\nThis procedure provides template for sheduling event. As input, date in format DD-MM-YYYY and time in format HH:MM of \nthe event provides as [parameters](#parameter), and the duration of the event could be provided by different mutually\nexclusively [switches](#switch):\n\n| switch name | description                                        |\n|-------------|----------------------------------------------------|\n| -allday     | select the duration of event to the end of the day |\n| -duration   | set duration of the event in format HH:MM          |\n| -endtime    | set end time of the event in format HH:MM          |\n\nAdditionaly, the validation expressions for the date format and time format regular expression is used. These expression\nare supplied as  named expressions in dictionary argument to global switch `-validate`.\n\nOne of the switches `-allday`, `-duration` or `-endtime` must be presented, so additional checking is done after \nargument processing.\n\nNormal operation:\n\n```tcl\nsheduleEvent -duration 01:30 20-12-2024 13:30\n```\n```text\n==\u003e duration 01:30 date 20-12-2024 time 13:30\n```\n\nError is issued in case of providing conflicting switches:\n\n```tcl\nsheduleEvent -allday -duration 01:30 20-12-2024 13:30\n```\n```{tclerr}\n-allday conflicts with -duration\n```\n\n\n## Allow\n\n[Element switch](#element-switch) `-allow` is inverse of `-forbid` switch. Only elements from definition list could\nbe presented if element is presented. As an example, we can use previous procedure but now implemented with `-allow`\ninstead of forbid:\n\n```tcl\nproc sheduleEvent {args} {\n    set arguments [argparse -inline\\\n            -validate [dict create date {[regexp {^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\\d{4}$} $arg]}\\\n                time {[regexp {^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$} $arg]}] {\n        {date -validate date}\n        {time -validate time}\n        {-allday -allow {date time}}\n        {-duration= -allow {date time} -validate time}\n        {-endtime= -allow {date time} -validate time}\n    }]\n    if {![dict exists $arguments allday] \u0026\u0026 ![dict exists $arguments duration] \u0026\u0026 ![dict exists $arguments endtime]} {\n        return -code error \"One of the switch must be presented: -allday, -duration or -endtime\"\n    }\n    return $arguments\n}\n```\n\nNormal operation:\n\n```tcl\nsheduleEvent -duration 01:30 20-12-2024 13:30\n```\n```text\n==\u003e duration 01:30 date 20-12-2024 time 13:30\n```\n\nError is issued in case of providing conflicting switches:\n\n```tcl\nsheduleEvent -allday -duration 01:30 20-12-2024 13:30\n```\n```{tclerr}\nallday doesn't allow duration\n```\n\n\n## Reciprocal\n\nSwtich with name `-reciprocal` is presented both as [global switch](#global-switch) and\n[element switch](#element-switch). In global case all [elements](#element) with `-require` switch are reciprocal to\nelements with names in argument to `-require` switch. Let's consider this definition:\n\n```tcl\nargparse -reciprocal {\n    {-a= -require {b c}}\n    -b\n    -c=\n}\n```\n\nWith `-reciprocal` global switch, the `-b` and `-c` switches also require `-a` switch, because `-a` switch requires\nthem, so, it is equivalent to:\n\n```tcl\nargparse {\n    {-a= -require {b c}}\n    {-b -require a}\n    {-c= -require a}\n}\n```\n\nElement switch `-reciprocal` do the same thing but only for that particular element.\n\n## Imply\n\n`-imply` [element switch](#element-switch) allows to specify additional argument to the [switch](#switch). Extra \n[argument](#argument) will be assigned to different switch specified in argument to `-imply` switch. For example:\n\n```tcl\nproc implyTest {args} {\n    set arguments [argparse -inline {\n        -a=\n        {-b= -imply -c}\n        -c=\n    }]\n    return $arguments\n}\n```\n\nIf we provide an additional argument to `-b`, it will be assigned to `-c` [key](#key):\n\n```tcl\nimplyTest -a 1 -b 2 3\n```\n```text\n==\u003e a 1 b 2 c 3\n```\n\nIf additional argument is not provided, the error is raised:\n\n```tcl\nimplyTest -a 1 -b 2\n```\n```{tclerr}\n-c requires an argument\n```\n\n\nAnd if `-b` switch with argument is not provided at all, `-c` is also considered omitted:\n\n```tcl\nimplyTest -a 1\n```\n```text\n==\u003e a 1\n```\n\n## Passthrough and normalization\n\nThe per-element `-pass` [switch](#element-switch) causes the [element](#element) [argument](#argument) or arguments to\nbe appended to the value of the indicated pass-through result [key](#key). Many elements may use the same pass-through\nkey. If `-normalize` is used, switch arguments are normalized to not use aliases, abbreviations, the `--` prefix, or the\n`=` argument delimiter; otherwise, switches will be expressed the same way they appear in the original input.\n\nFurthermore, `-normalize` causes omitted switches that accept arguments and have default [values](#value), as well as\nomitted [parameters](#parameter) that have default values, to be explicitly included in the pass-through key. If\n`-mixed` is used, pass-through keys will list all switches first before listing any parameters. If the first parameter\nvalue for a pass-through key starts with `-`, its value will be preceded by `--` so that it will not appear to be a\nswitch.  If no arguments are assigned to a pass-through key, its value will be empty string. The intention is that the\nvalue of a pass-through key can be parsed again to get the original data, and if `-normalize` is used, it will not be\nnecessary to use `-mixed`, `-long`, `-equalarg`, `-alias`, or `-default` to get the correct result. However,\npathological use of `-default` can conflict with this goal. For example, if the first optional parameter has no\n`-default` but the second one does, then parsing the result of `-normalize` can assign the default value to the first\nparameter rather than the second.\n\nThe [global switch](#global-switch) `-pass` switch may be used to collect unrecognized arguments into a pass-through\nkey, rather than failing with an error. Normalization and unmixing will not be applied to these arguments because it is\nnot possible to reliably determine if they are switches or parameters. In particular, it is not known if an undefined\nswitch expects an argument.\n\n## Upvar Elements\n\n[Elements](#element) with `-upvar` are special. Rather than having normal [values](#value), they are bound to caller\nvariables using the `[upvar]` command. `-upvar` conflicts with `-inline` because it is not possible to map a dict value\nto a variable. Due to limitations of arrays and `[upvar]`, `-upvar` cannot be used with [keys](#key) whose\n[names](#name) resemble array elements. `-upvar` conflicts with `-catchall` because the value must be a variable name,\nnot a list. The combination `-switch -optional -upvar` is disallowed for the same reason. If `-upvar` is used with\n[switches](#switch) or with optional [parameters](#parameter), `[info exists KEY]` returns 1 both when the element is\nnot present and when its value is the name of a nonexistent variable. To tell the difference, check if `[info vars KEY]`\nreturns an empty list; if so, the element is not present. Note that the argument to `[info vars]` is a `[string match]`\npattern, so it may be necessary to precede `*?[]\\` characters with backslashes.\n\n## Template\n\nSwtich with name `-template` is presented both as [global switch](#global-switch) and [element switch](#element-switch).\nIn global case all [elements](#element) names go through substitution before setting the caller variables or creating\nkey of the dictionary if `-inline` is provided. As an element switch individual substitution templates could be provided.\nThe most important usage is to use template to create array where names of elements become keys of array. As a\nsubstitution mark `%` symbol is used.\n\nAs an example let's use our previous procedure:\n\n```tcl\nproc genNums {args} {\n    argparse -template vars(%) {\n        # {Optional sequence control switches}\n        {-from= -default 1 -type double}\n        {-to=   -default 10 -type double}\n        {-step= -default 1 -type double}\n        {-prec= -default 1 -type double}\n    }\n    if {$vars(step) \u003c 0} {\n        set op ::tcl::mathop::\u003e\n    } else {\n        set op ::tcl::mathop::\u003c\n    }\n    for {set n $vars(from)} {[$op $n $vars(to)]} {set n [expr {$n + $vars(step)}]} {\n        lappend result [format %.*f $vars(prec) $n]\n    }\n    return $result\n}\ngenNums -from 0 -to 10 -step 2\n```\n```text\n==\u003e 0.0 2.0 4.0 6.0 8.0\n```\n\nHere all switches are accesible as an array element.\n\n-template applies to elements using neither -key nor -pass. To protect \"%\" or \"\\\" from replacement, precede it with \"\\\".\n\n## Help\n\nPackage allows to generate help description of command for the user when `-help` switch is provided as argument. In \nthat case, message with procedure and arguments description is put to stdout, and other arguments are ignored. So, we \ncan provide interactive help for the user of the command. To activate, [global switch](#global-switch) `-help` must be\nprovided. Let's take previous procedure `genNums` and add help to it:\n\n```tcl\nproc genNums {args} {\n    argparse -template vars(%) -help {Procedure generates sequence of numbers.} {\n        # {Optional sequence control switches}\n        {-from= -default 1 -type double -help {Provides start of sequence}}\n        {-to= -default 10 -type double -help {Provides end of sequence}}\n        {-step= -default 1 -type double -help {Provides step between adjacent numbers of sequence}}\n        {-prec= -default 1 -type double -help {Provides precision of numbers in the sequence}}\n    }\n    if {$vars(step) \u003c 0} {\n        set op ::tcl::mathop::\u003e\n    } else {\n        set op ::tcl::mathop::\u003c\n    }\n    for {set n $vars(from)} {[$op $n $vars(to)]} {set n [expr {$n + $vars(step)}]} {\n        lappend result [format %.*f $vars(prec) $n]\n    }\n    return $result\n}\ngenNums -help\n```\n```{tclerr}\n\n```\n\n\nGenerated message contains information important for the user of the command, not all information that is in definition\nof elements. Individual description for each parameter can be added as and argument to [element switch](#element-switch)\n`-help`.\n\nLet's use another procedure, this time with switches and parameters presented:\n\n```tcl\nproc sheduleEvent {args} {\n    set arguments [argparse -help {Procedure shedules event at cetain date. At least one of the switches must be\\\n        provided: -allday, -duration or -endtime} -inline\\\n            -validate [dict create date {[regexp {^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\\d{4}$} $arg]}\\\n                time {[regexp {^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$} $arg]}] {\n        {date -validate date -help {Provides date in format DD-MM-YY}}\n        {time -validate time -help {Provides time in format HH:MM}}\n        {-allday -allow {date time} -help {Set event duration for the rest of the day}}\n        {-duration= -allow {date time} -validate time -help {Set event duration in format HH:MM}}\n        {-endtime= -allow {date time} -validate time -help {Set end time of event in format HH:MM}}\n    }]\n    if {![dict exists $arguments allday] \u0026\u0026 ![dict exists $arguments duration] \u0026\u0026 ![dict exists $arguments endtime]} {\n        return -code error \"One of the switch must be presented: -allday, -duration or -endtime\"\n    }\n    return $arguments\n}\nsheduleEvent -help\n```\n```{tclerr}\n\n```\n\n\n## Argument Processing Sequence\n\n[Argument](#argument) processing is performed in three stages: [switch](#switch) processing, [parameter](#parameter)\nallocation, and parameter assignment. Each argument processing stage and pass is performed left-to-right.\n\n### Normal processing\n\nAll switches must normally appear in the argument list before any parameters. Switch processing terminates with the\nfirst argument (besides arguments to switches) that does not start with `-` (or `--`, if `-long` is used). The special\nswitch `--` can be used to force switch termination if the first parameter happens to start with `-`. If no switches are\ndefined, the first argument is known to be a parameter even if it starts with `-`. \n\nWhen `-mixed` is not used, the required parameters are counted, then that number of arguments at the **end** of the\nargument list are treated as parameters even if they begin with `-`. This avoids the need for `--` in many cases.\n\nAfter switch processing, parameter allocation determines how many arguments to assign to each parameter. Arguments\nassigned to switches are not used in parameter processing. First, arguments are allocated to required parameters;\nsecond, to optional, non-catchall parameters; and last to catchall parameters. Finally, each parameter is assigned the\nallocated number of arguments.\n\nLet's look at normal operation in the next example:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline {\n        -a=\n        -b=\n        -c\n        d\n        e?\n    }]\n    return $arguments\n}\nargProcSeq -c -a 1 2\n```\n```text\n==\u003e c {} a 1 d 2\n```\n\nFirst switches are processed, and there one argument left and it is assigned to required parameter `r`. If we provided\nanother additional argument, it will be assigned to optional parameter `e`:\n\n```tcl\nargProcSeq -c -a 1 2 3\n```\n```text\n==\u003e c {} a 1 d 2 e 3\n```\n\nMore complicated example:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline {\n        -a=\n        -b=\n        -c\n        d\n        e?\n        f\n    }]\n    return $arguments\n}\nargProcSeq -c -a 1 2 3\n```\n```text\n==\u003e c {} a 1 d 2 f 3\n```\n\nIn that case the last two arguments is assigned to *two* required parameters. If we provide two arguments after switch\n`-a`, then again they are assigned to required parameters, but because `-a` require argument, the error is thrown:\n\n```tcl\nargProcSeq -c -a 1 2\n```\n```{tclerr}\n-a requires an argument\n```\n\n\nIf we provide four arguments after `-a`:\n\n```tcl\nargProcSeq -c -a 1 2 3 4\n```\n```text\n==\u003e c {} a 1 d 2 e 3 f 4\n```\n\nAll three arguments are assigned to parameters in order presented in definition. So, if only two remaining arguments\nare there - they are assigned to two required parameters, **but** if three parameters presented, optional parameter\nalso gets the value in *order in definition*.\n\nThere is a special case when argument to parameter looks like a switch:\n\n```tcl\nargProcSeq -c -a 1 -2 3 4\n```\n```{tclerr}\nbad switch \"-2\": must be -a, -b, or -c\n```\n\n\nThe error is appeared because after counting required parameters (two required), last two arguments are assigned to\nthat parameters, and the -2 looks like a switch, so argparse tries to parse it as a switch. To fix that we can use `--`:\n\n```tcl\nargProcSeq -c -a 1 -- -2 3 4\n```\n```text\n==\u003e c {} a 1 d -2 e 3 f 4\n```\n\nIf one of the last two switches appears with `-`, all is processed as it should:\n\n```tcl\nargProcSeq -c -a 1 -- 2 -3 4\n```\n```text\n==\u003e c {} a 1 d 2 e -3 f 4\n```\n\n### Processing with parameters first\n\nIf `-mixed` is not used and `-pfirst` is used, the required parameters are counted, then that number of arguments at the\n**start** of the argument list are treated as parameters even if they begin with `-`.\n\nThe global switch `-pfirst` allows to assign first `n` arguments to `n` **required** parameters irrespectively of how\nthese arguments looks like. Then switches and optional parameters are processed.\n\nBut, even if number arguments are enough to assign to both required and optional parameters, required parameters are \nassigned first - it is different to how it works when parameters arguments are provided after switches. These two\nexamples demonstrating that:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline -pfirst {\n        -a=\n        -b=\n        -c\n        d\n        e?\n        f\n    }]\n    return $arguments\n}\nargProcSeq 1 2 -c -a 1\n```\n```text\n==\u003e c {} a 1 d 1 f 2\n```\n\n```tcl\nargProcSeq 1 2 3 -c -a 1\n```\n```text\n==\u003e c {} a 1 d 1 f 2 e 3\n```\n\nAlso, the remaining parameters could be provided after switches:\n\n```tcl\nargProcSeq 1 2 -c -a 1 3\n```\n```text\n==\u003e c {} a 1 d 1 f 2 e 3\n```\n\nBut it doesn't work in case of parameter argument looking like a switch:\n\n```tcl\nargProcSeq 1 2 -c -a 1 -3\n```\n```{tclerr}\nbad switch \"-3\": must be -a, -b, or -c\n```\n\n\nIn that case we can use the same trick with `--` termination of switch processing:\n\n```tcl\nargProcSeq 1 2 -c -a 1 -- -3\n```\n```text\n==\u003e c {} a 1 d 1 f 2 e -3\n```\n\nAlso there is a special treatment of `-catchall` parameter:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline -pfirst {\n        -a=\n        -b=\n        -c\n        d\n        e?\n        f\n        {g -catchall}\n    }]\n    return $arguments\n}\nargProcSeq 1 2 -c -a 1 3 4\n```\n```text\n==\u003e c {} a 1 d 1 f 2 e 3 g 4\n```\n\nCatchall parameters are treated after required and optional parameters.\n\n### Processing with mixed\n\nWhen the `-mixed` switch is used, switch processing continues after encountering arguments that start with `-` or\n`--`. This is convenient but may be ambiguous in cases where parameters look like switches. To resolve ambiguity, the\nspecial `--` switch terminates switch processing and forces all remaining arguments to be parameters.\n\nLet's see in example:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline -mixed {\n        -a=\n        -b=\n        -c\n        d\n        e?\n        f\n        {g -catchall}\n    }]\n    return $arguments\n}\nargProcSeq 1 2 -c -a 1 3 4\n```\n```text\n==\u003e c {} a 1 d 1 e 2 f 3 g 4\n```\n\nThe result is different from the last example from [chapter](#processing-with-parameters-first) example because in this \ncase the process is going as usual, but can be interrupted by providing switch with possible arguments.\n\nThe processing could be altered multiple times:\n\n```tcl\nproc argProcSeq {args} {\n    set arguments [argparse -inline -mixed {\n        -a=\n        -b=\n        -c\n        d\n        e?\n        f\n        {g -catchall}\n    }]\n    return $arguments\n}\nargProcSeq 1 -c 2 -a 1 3 4\n```\n```text\n==\u003e c {} a 1 d 1 e 2 f 3 g 4\n```\n\nResult is exact the same as in the previous example. Problems started when parameter looks like a switch, in that case\nonly `--` can force the rest of arguments considered as parameters arguments:\n\n```tcl\nargProcSeq 1 -c -2 -a 1 3 4\n```\n```{tclerr}\nbad switch \"-2\": must be -a, -b, or -c\n```\n\n\n```tcl\nargProcSeq 1 -c -a 1 -- -2 3 4\n```\n```text\n==\u003e c {} a 1 d -2 e 3 f 4 g {}\n```\n\nin that case the arguments before switch `--` that are not arguments to switches and does not look like a switch are \nignored.\n\n\n## Return Value\n\n`[argparse]` produces a set of [keys](#key) and [values](#value). The keys are the names of caller variables into which\nthe values are stored, unless `-inline` is used, in which case the key-value pairs are returned as a dict. The\n[element](#element) [names](#name) default to the key names, unless overridden by `-key`, `-pass`, or `-template`. If\nboth `-key` and `-pass` are used, two keys are defined: one having the element value, the other having the pass-through\nelements. Unless `-keep` or `-inline` are used, the caller variables for omitted switches and parameters are unset.\n\n## Author(s)\n\nAndy Goth \u003candrew.m.goth@gmail.com\u003e - all code and most of documentation\n\nGeorge Yashin \u003cgeorgtree@gmail.com\u003e - some documentation, test suite and new features, C implementation\n\nAshok P. Nadkarni \u003capnmbx-wits@yahoo.com\u003e - fix of C implementation and valuable advices about the code architecture\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgtree%2Fargparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgtree%2Fargparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgtree%2Fargparse/lists"}