Textualize / rich-cli

Rich-cli is a command line toolbox for fancy output in the terminal
https://www.textualize.io
MIT License
2.99k stars 77 forks source link

rich-cli needs a --force-terminal #3

Closed willmcgugan closed 2 years ago

willmcgugan commented 2 years ago

We will need a --force-terminal switch (plus single letter -f if its free) which forces terminal output. To allow users to pip to a file while allowing ansi codes (for pagers etc).

henryiii commented 2 years ago

Did this get added? Don't see a linked PR. I tried | less and | head, and both remove the highlighting, which is why I'd use rich-cli in the first place - I can always cat or use NOCOLOR if I don't want highlighting. :)

Ahh, I see https://github.com/Textualize/rich-cli/commit/12fed46d2368674b1ff6ae32903e23601c52bed3, so I guess yes?

Also there are no tags or GH releases, so it's hard to see what's released and what's just in main. Could I also request a --version flag so I can tell what I'm running? :)

henryiii commented 2 years ago

Ah, pip cache purge let me get the new version, it seems --force-terminal has even been released. Would love a version flag. ;)

head and tail work with --force-terminal (though less and more don't, for some reason I thought they supported escape sequences)

Ouch! Not only does -h not give help like most apps, but now it's taken as a shortcut to --head instead of --help. I'm sad.

darrenburns commented 2 years ago

@henryiii You'll need to use less -r when piping to less to tell it to interpret the sequences.

henryiii commented 2 years ago

Fantastic, thanks! --pager helps, but it doesn't support / search (yet?), so using a pager that does can be useful.

ernstki commented 2 years ago

Fantastic, thanks! --pager helps, but it doesn't support / search (yet?), so using a pager that does can be useful.

See also.