Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
optparse
is deprecated since Python 3.2: https://docs.python.org/3/library/optparse.htmlThis PR updates the
optparse
code to useargparse
, as well as to use the variable naming conventions that are typically used withargparse
code. See: https://docs.python.org/3/library/argparse.html#upgrading-optparse-codeAlso: you had one function called
parse_args
which (1) built a parser, and (2) invoked the parser to actually read the command line args, and then execute some follow-up logic. I broke this into two functions.Some context
I have a simple script for automatically-generating fish completions for commands implemented in Python. I was using it to generate
nodeenv
completions for fish (submitted in this PR). Since most Python commands useargparse
, andoptparse
is deprecated, I went ahead and bumped nodeenv toargparse
.Notes
For long arguments
--like-this=some_value
, using the equals sign is optional: https://stackoverflow.com/questions/14567289/equals-sign-in-pythons-argumentI understand if you don't want to merge this upstream for whatever reason (inconvenience, not worth it for you, etc.), but I figured I'd submit in case you like the bump to
argparse
.