Thanks for your work on this very exciting CLI parser.
See #39, which does not appear to cover this.
I want to create a command fing which combines several files, with a usage like this:
usage: fing [-h] PATH [PATH ...]
but the naïve:
def main(*files: Path) -> None:
print(*files)
gives
usage: /Users/tom/code/fing/fing/__main__.py [-h] [--files [PATH [PATH ...]]]
I don't see any examples of a command which doesn't use flags, and I see this unit test seemingly confirming this behavior.
After some fiddling, I found out that this works:
def main(files: list[Path], /) -> None:
print(files)
but this doesn't:
def main(files: list[Path]) -> None:
print(files)
and of course, this isn't even correct Python:
def main(*files: Path, /) -> None:
print(files)
The above workaround seems very reasonable once you know it: I'm suggesting that it be documented somewhere around https://brentyi.github.io/tyro/examples/basics/#positional-arguments
Thanks for your work on this very exciting CLI parser.
See #39, which does not appear to cover this.
I want to create a command
fingwhich combines several files, with a usage like this:but the naïve:
gives
I don't see any examples of a command which doesn't use flags, and I see this unit test seemingly confirming this behavior.
After some fiddling, I found out that this works:
but this doesn't:
and of course, this isn't even correct Python:
The above workaround seems very reasonable once you know it: I'm suggesting that it be documented somewhere around https://brentyi.github.io/tyro/examples/basics/#positional-arguments