generateUsage function

String generateUsage(
  1. List optionsAndSeparators, {
  2. int? lineLength,
})

Generates a string of usage (i.e. help) text for a list of options.

Internally, it works like a tabular src.printer. The output is divided into three horizontal columns, like so:

-h, --help  Prints the usage information
|  |        |                                 |

It builds the usage text up one column at a time and handles padding with spaces and wrapping to the next line to keep the cells correctly lined up.

lineLength specifies the horizontal character position at which the help text is wrapped. Help that extends past this column will be wrapped at the nearest whitespace (or truncated if there is no available whitespace). If null there will not be any wrapping.

Implementation

String generateUsage(List optionsAndSeparators, {int? lineLength}) =>
    _Usage(optionsAndSeparators, lineLength).generate();