Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing Text.from_ansi in rich-cli #83

Open
slafs opened this issue Feb 17, 2023 · 1 comment · May be fixed by #84
Open

Exposing Text.from_ansi in rich-cli #83

slafs opened this issue Feb 17, 2023 · 1 comment · May be fixed by #84

Comments

@slafs
Copy link

slafs commented Feb 17, 2023

I recently had to "clean" a log file from ANSI codes.
Couldn't find a quick solution for this in bash, so I turned to rich-cli, but wit no luck either.
Thankfully rich (the library) has just the right trick for that. I can use Text.from_ansi and print it however I want (stripped from codes).

I was wondering if this Text.from_ansi would be useful to expose here in this tool.

It could maybe have a --ansi option and then for my use case one could use it like so:

rich --ansi text_with_ansi_codes.txt > text_stripped.txt

Not sure if this option would be useful for anything else (you could probably only adjust alignment, style and maybe export to html/svg) 🤔 ?

Anyway, does this make sense?

@slafs slafs linked a pull request Feb 17, 2023 that will close this issue
@slafs
Copy link
Author

slafs commented Feb 17, 2023

I gave it a try in #84 and... works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant