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

implements column-aligned multi-line help message for arguments #259

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

heshiming
Copy link
Contributor

Hi, I'd like to provide this little implementation regarding column-aligned multi-line help message that works for arguments (not subcommands). This was discussed in #248 but the original poster didn't open a pull request.

In test_help.cpp I didn't see a test that validates the help message on a per-character level, so I didn't write any test.

Copy link
Contributor

@skrobinson skrobinson left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

}
prev += pos - prev + 1;
}
if (first_line)
Copy link

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
if (first_line)
if (first_line) {

}
if (first_line)
stream << "\t" << argument.m_help;
else {
Copy link

Choose a reason for hiding this comment

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

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
else {
} else {

stream << "\t" << argument.m_help;
else {
auto leftover = argument.m_help.substr(prev, argument.m_help.size() - prev);
if (leftover.size() > 0) {
Copy link

Choose a reason for hiding this comment

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

⚠️ readability-container-size-empty ⚠️
the empty method should be used to check for emptiness instead of size

Suggested change
if (leftover.size() > 0) {
if (!leftover.empty()) {

@p-ranav
Copy link
Owner

p-ranav commented Feb 5, 2023

Please fix these minor clang-tidy issues and then we can merge it in 👍

fanurs pushed a commit to fanurs/argparse that referenced this pull request Apr 22, 2023
@p-ranav p-ranav merged commit 3d75967 into p-ranav:master Jul 11, 2023
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.

3 participants