Arg::requires
requires
Section titled “requires ”Sets an argument that is required when this one is present.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”name = "prog"[args]cfg = { long = "config", requires = "input", action = "set" }input = {}
name: progargs: cfg: long: config requires: input action: set input: {}
{ "name": "prog", "args": { "cfg": { "long": "config", "requires": "input", "action": "set" }, "input": {} }}
prog
Output
Section titled “Output”
Example 2
Section titled “Example 2”name = "prog"[args]cfg = { long = "config", requires = "input", action = "set" }input = {}
name: progargs: cfg: long: config requires: input action: set input: {}
{ "name": "prog", "args": { "cfg": { "long": "config", "requires": "input", "action": "set" }, "input": {} }}
prog --config file.conf
Output
Section titled “Output”error: the following required arguments were not provided: <input>
Usage: prog --config <cfg> <input>
For more information, try '--help'.