asottile / pyupgrade

A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
MIT License
3.5k stars 177 forks source link

Improve documentation of supported arguments #938

Closed WoosterInitiative closed 5 months ago

WoosterInitiative commented 5 months ago

I would have sworn that I've seen some of this documented before, but I can't find it.

What I specifically was looking for was the supported version flags (--py310-plus, --py311-plus, etc.). I had a typo in mine in pre-commit (--312plus), which I could have determined myself without docs, but I feel that having them documented instead of buried at the bottom of a somewhat obscure _main.py file is less than intuitive.

I'd be happy to do it myself if there isn't an objection?

asottile commented 5 months ago

there's no reason to. when you typo'd the tool spit out the answer you were looking for directly and the standard way to ask a tool what it supports is via --help

WoosterInitiative commented 5 months ago

Sure, but when using pre-commit, there may not be a local install to run --help with. Also, the "answer" it provided was less than helpful. Helpful messages I've seen will say things like "'--py312plus' is not a valid argument, valid choices are '--py310-plus', '--py311-plus'" etc., or perhaps point to documentation.

I guess I don't see why this is such a difficult ask. Even if the readme pointed the user to the appropriate file to avoid having to remember to update the readme every time a new option was added, that would help hapless users such as myself, I think.

asottile commented 5 months ago

I've seen will say things like "'--py312plus' is not a valid argument, valid choices are '--py310-plus', '--py311-plus'" etc

that's literally what it does

WoosterInitiative commented 5 months ago

that's literally what it does

Holy balls, man, I missed that somehow. Just tested by intentionally mis-typing it and it does exactly that. Sorry for the trouble!

asottile commented 5 months ago

I'm sure you can see now why I'm frustrated that you wasted both of our time on this