COLUMNS env var

setting env var to a number greater than 0 will make the terminal resize to that number of columns.

setting COLUMNS env var to a number greater than 0 will make the terminal resize to that number of columns.

COLUMNS=80 uvx --from rich-cli rich myscript.py

Note

Not all programs respct the COLUMNS env var, but rich does, and a lot of stuff I’m building uses rich.

I discovered this when I was trying to make a low effort readme generated from the code, but did not depend on the size of terminal it was ran on.

# justfile
readme:
    echo "# Workspaces" > README.md
    echo "" >> README.md
    echo '``` bash' >> README.md
    COLUMNS=80 ./workspaces.py --help >> README.md
    echo '```' >> README.md

Connections

Related tags and posts connected to this entry.