Skip to content

unrecognized option bug since 1.09 #457

@leCapi

Description

@leCapi
#! /usr/bin/env python3
import dataclasses
import pathlib
from typing import Annotated

import tyro


@dataclasses.dataclass
class Arguments:
    # logs files paths to process
    logfile_paths: tyro.conf.Positional[tuple[pathlib.Path, ...]]
    # configuration file for the drain3 template miner.
    cfg_file: Annotated[pathlib.Path, tyro.conf.arg(aliases=["-c"])] = pathlib.Path(
        "config.yaml"
    )


if __name__ == "__main__":
    cfg = tyro.cli(Arguments)
    print(cfg)

i run this command :
./tyrobug.py --invalid

With tyro 1.0.8 (good):

╭─ Unrecognized options ─────────────────────╮
│ Unrecognized options: --invalid            │
│ ────────────────────────────────────────── │
│ For full helptext, run ./tyrobug.py --help │
╰────────────────────────────────────────────╯

with tyro >=1.0.9:
No error (not good)
Arguments(logfile_paths=(PosixPath('--invalid'),), cfg_file=PosixPath('config.yaml'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions