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 Outdated Show resolved Hide resolved
Python/initconfig.c Outdated Show resolved Hide resolved
@merwok merwok marked this pull request as ready for review January 2, 2022 23:16
@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

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 January 3, 2022 15:28
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

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 commented Jan 3, 2022

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

@merwok merwok linked an issue May 25, 2022 that may be closed by this pull request
@@ -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

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

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 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 only security fixes 🔨 test-with-buildbots Test PR w/ buildbots; report in status section labels May 31, 2022
@bedevere-bot
Copy link

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 31, 2022
@merwok merwok merged commit 8aa9d40 into python:main Jun 1, 2022
@miss-islington
Copy link
Contributor

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 June 1, 2022 09:50
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request 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 bedevere-bot removed the needs backport to 3.11 only security fixes label Jun 1, 2022
@bedevere-bot
Copy link

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

@ericsnowcurrently
Copy link
Member

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

miss-islington added a commit that referenced this pull request Jun 14, 2022
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

python --help output is too long