New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json.tool ought to have a help flag #65199
Comments
I current get this behavior:
% python3 -m json.tool -h
Traceback (most recent call last):
File "/usr/lib64/python3.3/runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python3.3/runpy.py", line 73, in _run_code
exec(code, run_globals)
File "/usr/lib64/python3.3/json/tool.py", line 40, in <module>
main()
File "/usr/lib64/python3.3/json/tool.py", line 21, in main
infile = open(sys.argv[1], 'r')
FileNotFoundError: [Errno 2] No such file or directory: '-h' Instead of that, json.tool should show a helpful message expalining what it does in response to the -h or --help flags. |
Very nice, but your help message still doesn't explain what json.tool does. :) |
Perhaps this thing should use argparse? |
Here's a new patch. Changes:
|
This looks like a nice improvement. |
Thanks a lot for the excellent patch! |
New changeset a2ad16e86e60 by Benjamin Peterson in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: