brew leaves
show the result with one column unlike brew list
, which shows it with multiple columns (actual number depending on the terminal window size). How can I achieve the same effect with brew leaves
?
Asked
Active
Viewed 289 times
1 Answers
0
EDIT (much simpler): brew leaves | column
(Original answer)
Just use: brew leaves | column -c $(tput cols)
Explanation:
|
is a pipe, which connect the output of brew leaves
to the input of column -c $(tput cols)
The -c option determines the width of the created table (c stands for console columns, not for table columns).
find the width & height of a terminal window:
tput cols
tells you the number of columns.
$(<your command>)
lets you use the command output as variable.

johan
- 1,664
- 2
- 14
- 30
-
1You could use the built-in `$COLUMNS` instead of `$(tput cols)`, or even easier, just skip that option as `column` defaults to the full available width. – Benjamin W. Jan 15 '19 at 15:55