Re: Mutually exclusive options with argparse.

2021-09-02 Thread hongy...@gmail.com
On Thursday, September 2, 2021 at 10:16:09 AM UTC+8, hongy...@gmail.com wrote: > On Wednesday, September 1, 2021 at 11:20:21 PM UTC+8, Lee Congdon wrote: > > Does a mutually exclusive group, as described in "Mutual exclusion" at > > https://docs.python.org/3/library/argparse.html meet your needs?

Re: Mutually exclusive options with argparse.

2021-09-02 Thread hongy...@gmail.com
On Wednesday, September 1, 2021 at 11:20:21 PM UTC+8, Lee Congdon wrote: > Does a mutually exclusive group, as described in "Mutual exclusion" at > https://docs.python.org/3/library/argparse.html meet your needs? Thanks for letting me know about this feature. I'll give it a try. > > On Wed, Se

Re: Mutually exclusive options with argparse.

2021-09-01 Thread Lee Congdon
Does a mutually exclusive group, as described in "Mutual exclusion" at https://docs.python.org/3/library/argparse.html meet your needs? On Wed, Sep 1, 2021 at 9:48 AM hongy...@gmail.com wrote: > See the following code snippets [1] for implementation of the exclusive > options with argparse: > >

Mutually exclusive options with argparse.

2021-09-01 Thread hongy...@gmail.com
See the following code snippets [1] for implementation of the exclusive options with argparse: def query_builder(args): if args.r and args.s: sys.exit(Term.FAIL + 'Only one of -re and -sql should be set' + Term.ENDC) sum_status = sum(1 for x in [args.failure, args.code != -1] if