Textualize / rich-cli

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

Unable to read files with no lexer #11

Closed liiight closed 2 years ago

liiight commented 2 years ago

When trying to load a file that does not have a lexer (without specifying a lexer override via -x), the file fails to load:

$ rich us1.env
unable to read us1.env: no lexer for filename 'us1.env' found

I would like to suggest a fallback to text lexer, perhaps with a warning message, instead of not displaying the file

liiight commented 2 years ago

@willmcgugan I'd like to take a jab at doing this, if that's ok

willmcgugan commented 2 years ago

You're more than welcome! What does the text lexer do? Maybe you could just print it there is no lexer.

liiight commented 2 years ago

Text lexer just print the contents as plain text, I think that's a sensible fallback. Maybe a switch can be added, like --enable-lexer-fallback ?

giorgiberia commented 2 years ago

I think this should be the default fallback. available even without a switch

liiight commented 2 years ago

Merged via #12

giorgiberia commented 2 years ago

Hi there. in my understanding, this should be working right? image rich should have displayed file

willmcgugan commented 2 years ago

Try upgrading rich-cli

giorgiberia commented 2 years ago

I noticed this after upgrading with pipx. which is the latest version?

giorgiberia commented 2 years ago

this is not fixed.