75lb / command-line-usage

A simple, data-driven module for creating a usage guide.
MIT License
208 stars 36 forks source link

make optionList width configurable #13

Closed 75lb closed 6 years ago

75lb commented 7 years ago

Currently, the width of a content section is configurable. Here's an example of a content section with a maxWidth of 40:

const usage = commandLineUsage([
  {
    header: 'A typical app',
    content: {
      options: { maxWidth: 40 },
      data: [
        { col: 'Generates something [italic]{very} important. This is a rather long, but ultimately inconsequential description intended solely to demonstrate description appearance. ' }
      ]
    }
  }
])

Output:

A typical app

  Generates something very important.
  This is a rather long, but ultimately
  inconsequential description intended
  solely to demonstrate description
  appearance.

However, an optionList section currently has a fixed width of 80 columns which is an issue for some users.

Resolve this issue by making the maxWidth of an optionList section configurable, the same way as it is for a content section.

AriLFrankel commented 6 years ago

I'd be happy to work on this if you're still looking for a hand :)

EDIT: I opened a PR that I think resolves this. Let me know if you get a chance to take a look :)

75lb commented 6 years ago

Fixed and released in v5.0.0.