It is currently possible to define non optional lists by using nargs="+", but the documentation does not mention this.
As this is especially interesting for positional arguments I would propose to add it to that section of the documentation
For example:
from pathlib import Path
import typed_argparse as tap
class Args(tap.TypedArgs):
dst: Path = tap.arg(positional=True, help="Destination file")
files: list[Path] = tap.arg(positional=True, help="Source file", nargs="+")
def runner(args: Args):
print(f"Print copying from '{args.src}' to '{args.dst}'")
def main() -> None:
tap.Parser(Args).bind(runner).run()
if __name__ == "__main__":
main()
usage: test.py [-h] dst files [files ...]
positional arguments:
dst Destination file
files Source file
options:
-h, --help show this help message and exit
Thanks for the suggestion! Indeed, some features are already implemented, but I haven't had time to document them well. I've now added a section for multiple positional arguments in the docs.
It is currently possible to define non optional lists by using
nargs="+"
, but the documentation does not mention this. As this is especially interesting for positional arguments I would propose to add it to that section of the documentationFor example: