Skip to content

Improve usage and help text formatting

Choose a tag to compare

@glentner glentner released this 23 Jan 22:01
· 35 commits to master since this release
2.7.4
6136dd6

The ansi.py module holds a collection of regular expressions
that apply automatic formatting to usage and help text with
standard syntax.

This change addresses the following:

  • Section headers are generic match on capitalized word at the
    start of a line ending in a colon, instead of only matching
    on a list of magic words.
  • Metavars (e.g., FILE, ADDR, PORT) are matched on any all-caps
    word not contained by quotes, not preceded by dash; instead of
    being a reserved list of magic words.
  • Match any 4+ character word contained by angle brackets
    instead of reserved list of magic words.
  • Add small list of special list of reserved resources, including
    localhost, stdin, stdout, and stderr.
  • Fix option pattern to include stacked single letter options.
  • Fix digit matching to include decimals, this also makes IP
    addresses match like numbers (naive but works).
  • Add to digit matching suffixes for count (K, M, G, T) along
    with optional 'b' for bytes, case insensitive.