Skip to content
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

gh-90300: split --help output into separate options #30331

Merged
merged 33 commits into from Jun 1, 2022

Conversation

merwok
Copy link
Member

@merwok merwok commented Jan 2, 2022

gh-90300: Make --help output shorter and add new help options.

--help-env, --help-xoptions and --help-all command-line options are
added to complement --help.

Python/initconfig.c Outdated Show resolved Hide resolved
Python/initconfig.c Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
@merwok merwok marked this pull request as ready for review Jan 2, 2022
@merwok merwok changed the title bpo-46142: make python --help output shorter [WIP] bpo-46142: split --help output into separate options Jan 2, 2022
Lib/test/test_cmd_line.py Outdated Show resolved Hide resolved
Misc/python.man Outdated Show resolved Hide resolved
]
[
.B \-X help
]
Copy link
Member Author

@merwok merwok Jan 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought showing all help options on their own line could be nice.

Python/initconfig.c Outdated Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
@merwok merwok requested a review from warsaw Jan 3, 2022
Doc/using/cmdline.rst Outdated Show resolved Hide resolved
Doc/using/cmdline.rst Outdated Show resolved Hide resolved
Lib/test/test_cmd_line.py Outdated Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
Python/initconfig.c Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jan 3, 2022

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@warsaw
Copy link
Member

@warsaw warsaw commented Jan 3, 2022

Thanks for working on this! I left some comments and suggestions.

@merwok merwok changed the title bpo-46142: split --help output into separate options gh-90300: split --help output into separate options May 25, 2022
@merwok merwok linked an issue May 25, 2022 that may be closed by this pull request
Python/initconfig.c Outdated Show resolved Hide resolved
@@ -2085,7 +2106,7 @@ config_read(PyConfig *config, int compute_path_config)
/* -X options */
const wchar_t* option = _Py_check_xoptions(&config->xoptions, known_xoptions);
if (option != NULL) {
return PyStatus_Error("Unknown value for option -X");
return PyStatus_Error("Unknown value for option -X (see --help-xoptions)");
}
Copy link
Member Author

@merwok merwok May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that showing the invalid value in this error message is not trivial: real C programmers had issue with it too before #28823

when the interpreter displays tracebacks.\n\
-X frozen_modules=[on|off]: whether or not frozen modules should be used.\n\
The default is \"on\" (or \"off\" if you are running a local build).\n\
-X opt : set implementation-specific option\n\
Copy link
Member

@AA-Turner AA-Turner May 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--help-xoptions is listed a few items below, but if scanning the list it might be helpful to explicitly mention it here. (Sorry if it's been suggested before & declined!).

Suggested change
-X opt : set implementation-specific option\n\
-X opt : set implementation-specific option (see --help-xoptions)\n\

Copy link
Member Author

@merwok merwok May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve added it and removed it. In the current version, I think it is not needed, as it is a few lines later and in the man page and shown in error message for unknown X option, but have no problem adding it if someone adds 👍🏽 to your comment 🙂

@merwok
Copy link
Member Author

@merwok merwok commented May 31, 2022

This is ready and complete for me. I did not change all lines to be <80 columns like Serhiy requested, but the upside is that the diff size is very reasonable. I would like to merge this week-end, or sooner if there are approving reviews, then create the backport PR for 3.11.

@merwok merwok added needs backport to 3.11 🔨 test-with-buildbots labels May 31, 2022
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 31, 2022

🤖 New build scheduled with the buildbot fleet by @merwok for commit 5485255 🤖

If you want to schedule another build, you need to add the "🔨 test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots label May 31, 2022
@merwok merwok merged commit 8aa9d40 into python:main Jun 1, 2022
85 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 1, 2022

Thanks @merwok for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖 I'm not a witch! I'm not a witch!

@merwok merwok deleted the shorten-help-output branch Jun 1, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 1, 2022
…0331)

Make --help output shorter and add new help options.

--help-env, --help-xoptions and --help-all command-line options are
added to complement --help.
(cherry picked from commit 8aa9d40)

Co-authored-by: Éric <earaujo@caravan.coop>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jun 1, 2022

GH-93413 is a backport of this pull request to the 3.11 branch.

@ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Jun 2, 2022

🎉 Thanks for seeing this through, @merwok! It's a nice improvement. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.