eladrich / pyrallis

Pyrallis is a framework for structured configuration parsing from both cmd and files. Simply define your desired configuration structure as a dataclass and let pyrallis do the rest!
https://eladrich.github.io/pyrallis/
MIT License
189 stars 7 forks source link

support for -h raises an error #22

Open sleepwalker2017 opened 1 year ago

sleepwalker2017 commented 1 year ago

my code is like this.

@dataclass
class Person:
    name: str = 'John'
    age: int = 18

if __name__ == '__main__':
    import sys
    print(sys.argv)
    #main()
    parser = argparse.ArgumentParser()

    parser.add_argument('--config_path', type=str)
    parser.add_argument('hps', nargs=argparse.REMAINDER)
    args = parser.parse_args()
    print(args)
    cfg = pyrallis.parse(Person, config_path = args.config_path, args = args.hps[1:])
    print(cfg)

when I run python simple_test.py hps --help, it give right help messages. but when I run python simple_test.py hps -h, it raise an exception.

Is this a bug?

image