nstrydom2 / anonfile-api

An unofficial Python Anonfiles.com API
MIT License
62 stars 24 forks source link

Add UA CLI PR #63

Closed nstrydom2 closed 3 years ago

nstrydom2 commented 3 years ago

Closes #62

hentai-chan commented 3 years ago

Just FYI, changing this line this also means you lose the --no-verbose options etc.

- parser.add_argument('-V', '--verbose', default=True, action=argparse.BooleanOptionalAction, help="increase output verbosity")
+ parser.add_argument('-V', '--verbose', default=True, action='store_true', help="increase output verbosity")

What might have happened to you (and I'm sorry I didn't notice this earlier) is that this feature is only available in version 3.9 or higher, see also the docs for more information.

nstrydom2 commented 3 years ago

Just FYI, changing this line this also means you lose the --no-verbose options etc.

- parser.add_argument('-V', '--verbose', default=True, action=argparse.BooleanOptionalAction, help="increase output verbosity")
+ parser.add_argument('-V', '--verbose', default=True, action='store_true', help="increase output verbosity")

What might have happened to you (and I'm sorry I didn't notice this earlier) is that this feature is only available in version 3.9 or higher, see also the docs for more information.

Right. Which is why I removed it. I had come to the same conclusion.

hentai-chan commented 3 years ago

That's fine. Did you test if the user can still turn off these features?

nstrydom2 commented 3 years ago

That's fine. Did you test if the user can still turn off these features?

Good catch 💯

hentai-chan commented 3 years ago

I suspect you might have to change the defaults to False, so the user has to enable them manually all over again with --verbose, --logging, and so on. Hence why I looked into an alternative solution.

nstrydom2 commented 3 years ago

What would you do?

hentai-chan commented 3 years ago

Roll out your own implementation for this flag :D

hentai-chan commented 3 years ago

This could also work:

  1. add another --no-verbose flag that defaults to False (in addition to --verbose which defaults to True
  2. Then pass (args.verbose ^ args.no_verbose) (XOR) to the progressbar parameter

Rinse and repeat for all the other options.

Edit: Changed it a few times, but I tested it quickly in the terminal:

verbose=True
noverbose=False

# True
print(verbose ^ nonverbose)

noverbose=True

# False
print(verbose ^ nonverbose)

The logic seems to check out this time :)