Menu ▾ ▴

#117 Format lists in --help text

open
nobody
None
5
2008-06-26
2008-06-26
No

A simple way of formatting the formats, effects, sound devices &c. lists in the help text would be to read the environment variable "COLUMNS", and then format to that width, by which I mean, keep an x count, and if you would go over it printing out a space and the next entry, and you're not already on column 0, then print a newline first. Only try to read a positive number, from COLUMNS, and if you fail or COLUMNS isn't set, don't bother wrapping.

If you believe that programs ever want to parse the output of sox --help, you also probably want not to format if isatty returns 0 (isatty isn't standard, so needs to be added to AC_CHECK_FUNCTIONS; if you don't get it, you simply don't compile that check).

Discussion


Log in to post a comment.