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

Don't indent single line help / description text #232

Merged

Conversation

tommy-mitchell
Copy link
Contributor

Closes #229.

If help has no newlines and if description is false, or if description is set and help is false, don't indent the message:

$ my-command

Single-line usage info or description.

Comment on lines +302 to +305
// Change to `&&=` when targeting Node 15+
if (description) {
description = help ? `\n ${description}\n` : `\n${description}`;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Node 15+ supports logical AND assignment, which makes this simpler:

description &&= help ? `\n  ${description}\n` : `\n${description}`;

@sindresorhus sindresorhus merged commit a5d15e8 into sindresorhus:main Mar 28, 2023
3 checks passed
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.

Allow single line help messages
2 participants