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

cli: be more flexible about width when printing --help #22637

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes (presumably)
  • commit message follows commit guidelines

Copy link

@mohammed-adil-moughal mohammed-adil-moughal left a comment

Choose a reason for hiding this comment

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

looks good

@targos targos self-assigned this Sep 1, 2018
@targos targos self-requested a review September 1, 2018 10:55
@targos targos removed their assignment Sep 1, 2018
Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

I love it!

// Use 75 % of the available width, and at least 70 characters.
const width = Math.max(70, (stream.columns * 0.75) | 0);
const firstColumn = (width * 0.4) | 0;
const secondColumn = (width * 0.57) | 0;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Math.floor is easier to understand than the bitwise operator

Copy link
Member Author

Choose a reason for hiding this comment

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

@targos Thanks for pointing that out, done!

@addaleax addaleax added the cli Issues and PRs related to the Node.js command line interface. label Sep 1, 2018
@addaleax
Copy link
Member Author

addaleax commented Sep 2, 2018

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 2, 2018
@addaleax
Copy link
Member Author

addaleax commented Sep 2, 2018

@danbev
Copy link
Contributor

danbev commented Sep 5, 2018

Landed in 089c0d1.

@danbev danbev closed this Sep 5, 2018
danbev pushed a commit that referenced this pull request Sep 5, 2018
PR-URL: #22637
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@addaleax addaleax deleted the help-width branch September 5, 2018 09:26
targos pushed a commit that referenced this pull request Sep 5, 2018
PR-URL: #22637
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos pushed a commit that referenced this pull request Sep 6, 2018
PR-URL: #22637
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. cli Issues and PRs related to the Node.js command line interface.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants