marcolardera / chatgpt-cli

Simple yet effective command line client for chatting with ChatGPT using the official API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add CLI option for raw text mode (no colors at all).

mk-pmb opened this issue · comments

commented

To simplify using this client in scripts, I'd like a raw text mode that avoids all terminal control codes (color, cursor positioning, not sure what else).
Raw text mode would thus include disabling markdown rendering.
I found the markdown option, but even with that disabled, the model name and separator line are still in color.
Also I'd like a CLI option for raw text mode.
Also raw text mode shall be the default if standard output is not a TTY. (Even better if we can check termcap for color code support, but that's probably a feature that should be implemented upstream in Rich.)
Also raw text mode shall be the default if using the dumb terminal (environment variable TERM is set to dumb).

You can pipe into ansi2txt from package colorized-logs

apt install colorized-logs
commented

Thanks for the idea! Indeed I had considered using sed to stip all terminal control codes from the output and the excess newlines after the input prompt. Nonetheless, I think all of the features requested above should be in chatgpt-cli.