Command line interface#

dargs: Argument checking for Python programs

usage: dargs [-h] [--version] {check,doc} ...

Named Arguments#

--version

show program’s version number and exit

Sub-commands#

check#

Check a JSON file against an Argument

dargs check [-h] -f FUNC [--no-strict] [--trim-pattern TRIM_PATTERN]
            [--allow-ref]
            [jdata ...]

Positional Arguments#

jdata

Path to the JSON file. If not given, read from stdin.

Default: [<_io.TextIOWrapper name=’<stdin>’ mode=’r’ encoding=’utf-8’>]

Named Arguments#

-f, --func

Function that returns an Argument object. E.g., dargs._test.test_arguments

--no-strict

Do not raise an error if the key is not pre-defined

Default: True

--trim-pattern

Pattern to trim the key

Default: “_*”

--allow-ref

Allow loading from external files via the $ref key

Default: False

Example: dargs check -f dargs._test.test_arguments test_arguments.json

doc#

Print documentation for an Argument

dargs doc [-h] func [arg]

Positional Arguments#

func

Function that returns an Argument or list of Arguments. E.g., dargs._test.test_arguments

arg

Optional argument path (e.g., ‘base/sub1’). If not provided, prints all top-level arguments.

Example: dargs doc dargs._test.test_arguments [arg_path]