Closed gwynne closed 10 months ago
@swift-ci please test
This looks great! Any ideas about how to test this? Could we set
COLUMNS
for some/one of the help generation tests to verify that it gets picked up as the default?
Test added!
@swift-ci Please test
@swift-ci Please test
As documented in both the Linux and BSD versions of the
environ(7)
manpage, many console utilities respect the presence of theCOLUMNS
andLINES
environment variables, treating them as overrides (or, less commonly, fallbacks) of the terminal's reported size (if any). This adds that same behavior to ArgumentParser's screen size logic, affecting the wrapping of the usage generator's output.Note: These changes follow the semantics of
ls(1)
, whereCOLUMNS
andLINES
individually override the values reported by a terminal when they are present. Setting only one of the two variables has no effect on the other. It is also worth noting that at the present time, overriding the screen height (i.e.LINES
) has no impact whatsoever on ArgumentParser's behavior.The new logic only takes effect on non-Windows/WASI platforms.
Checklist