Arg::required
required
Section titled “required ”Specifies that the argument must be present.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”name = "prog"[args]cfg = { long = "config", required = true, action = "set" }name: progargs: cfg: long: config required: true action: set{ "name": "prog", "args": { "cfg": { "long": "config", "required": true, "action": "set" } }}prog --config file.confOutput
Section titled “Output”claptrap_cfg='file.conf'Example 2
Section titled “Example 2”name = "prog"[args]cfg = { long = "config", required = true, action = "set" }name: progargs: cfg: long: config required: true action: set{ "name": "prog", "args": { "cfg": { "long": "config", "required": true, "action": "set" } }}progOutput
Section titled “Output”error: the following required arguments were not provided: --config <cfg>
Usage: prog --config <cfg>
For more information, try '--help'.