If you set CLIFF_FIT_WIDTH=1
, openstack cli will fit table output to the screen width.
However, this breaks if you try and pipe to less.
It seems like a possible workaround could be: alias openstack='openstack --max-width "$(tput cols)"'
but this seems hacky. Is there a flag or env var for openstack cli I missed so that I can pipe the output to less without the width breaking?
The problem is that because you're piping the output to another command, the
openstack
CLI is no longer attached to your terminal and isn't able to query the screen width.I usually just run
openstack ... | less -S
, which sort of does the opposite: it disables the wrapping of long lines so that the table displayed isn't mucked up.Your solution of injecting the output of
tput cols
seems a reasonable alternative.