yargs / yargs/cliui

Issue with Description Column not Rendering on Separate Line

Open
#88 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
JavaScript
Stars
395
Forks
44
Avg merge
6m
Merged PRs (30d)
3

Description

I inadvertently created an argument description that turned out to be 37 characters long. When help is displayed, the description displays as follows:

--lts, -l Download 'Long Term Support' releases[boolean] [default: false]

Personally I think it would look better if the line had a line break inserted via the _renderInLine function in order to keep the description from running into the square bracket. If the description is 38 characters in length, it will render the type and default on a separate line.

A simple change to the _renderInLine function in index.ts, changing this code:

if (leadingWhitespace < targetTextWidth) {

to this:

if (leadingWhitespace < targetTextWidth + 1) {

allows the line to break if the description is the maximum width of the field.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open index.ts and inspect the _renderInLine function, especially the leadingWhitespace and targetTextWidth condition. Verify the rendering behavior for descriptions at the maximum field width, then confirm that the type and default text break onto a separate line without affecting shorter descriptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.