|
| def | terminal_width (fallback=70) |
| | Get the width of the terminal, in characters. More...
|
| |
| def | hline (char='-', fallback=70) |
| |
| def | header (description, char='-', fallback=70) |
| |
| def | dot_pad (string, length) |
| |
| def | stringtable (strlist, ncolumns=4, padding=3, rowprefix='') |
| |
| def | linewrap (content, length) |
| |
| def | command_line (cmd, optionals=True, cols=None, prefix='') |
| | Nicely format a command line for output to terminal. More...
|
| |
Output formatting utilities.
| def carputils.format.command_line |
( |
|
cmd, |
|
|
|
optionals = True, |
|
|
|
cols = None, |
|
|
|
prefix = '' |
|
) |
| |
Nicely format a command line for output to terminal.
If joining the arguments with single spaces results in a string that will fit on one line, this is returned. Otherwise, a string containing the command line nicely displayed over many lines is returned.
Parameters
cmd list list of strings representing command line arguments optionals bool, optional If True (default), flags starting with '-' start new lines. If False, all arguments are on new lines. cols int, optional Specify the number of columns to fit inside, default: terminal width prefix str, optional A string to prefix each line of the formatted output
Returns
str The formatted command line