| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
I did not look at the new CliTest class. I have not use argparse but have read doc and examples and it looks good, and much nicer than existing. One suggestion.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
|
|
||
| url = args[0] | ||
| open(url, new_win) | ||
| def parse_args(arg_list: list[str] | None): |
There was a problem hiding this comment.
What's our current policy on stdlib type hints?
Sorry, something went wrong.
There was a problem hiding this comment.
python/devguide#1304 says in general don't add, but there are some specific exceptions, but that the policy is undocumented. I think these might be okay because they're "simple" and internal, but I'm also happy to remove if you'd prefer?
Sorry, something went wrong.
| "https://example.com -n -t", | ||
| "https://example.com --new-window --new-tab", | ||
| "https://example.com -n --new-tab", | ||
| "https://example.com --new-window -t", |
There was a problem hiding this comment.
argparse allows argument shortening and handles ambiguous shortenings as one might hope, but it might be nice to confirm that --new fails properly.
Sorry, something went wrong.
There was a problem hiding this comment.
Nice, I didn't know about that feature :) I've added a test case.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Replace getopt with argparse in webbrowser's CLI.
Also add long options for -n and -t: --new-window and --new-tab.
Add tests for the CLI (inspired by https://pythontest.com/testing-argparse-apps/), and for an error case of new().
Before
After
Plus some cleanup:
📚 Documentation preview 📚: https://cpython-previews--117047.org.readthedocs.build/