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

want color output for mls like ls #351

Open
bahamas10 opened this issue Aug 20, 2018 · 4 comments
Open

want color output for mls like ls #351

bahamas10 opened this issue Aug 20, 2018 · 4 comments

Comments

@bahamas10
Copy link
Contributor

I'd have to look more into how ls handles it (and how various version of ls handle it)... but I know off the top of my head there is LS_COLORS and LSCOLORS available as env variables... it would be cool if mls could use these variables if set, or have its own MLSCOLORS, and output color if stdout is a TTY.

@jasonbking
Copy link

GNU ls just takes the values and essentially spits out the control sequences. If you split the LS_COLORS value by semicolon, then you want to print the 'lc' value (default is '\e[', then the value for whatever filetype (no, or a glob match), then the 'rc' value (default is 'm', the filename, then the 'ec' value (I think the default is '\e[0m'.

@jasonbking
Copy link

BSD is completely different of course. illumos doesn't assume all the world is xterm, and converts the LS_COLORS sequences back to color codes and then uses the terminfo database to output the correct sequence.

@bahamas10
Copy link
Contributor Author

^ Interesting.... so it appears they all do something different. hm. If node-manta is to support this, I definitely want it done right and not make any assumptions if we can avoid it.

@jasonbking
Copy link

You could probably go off the existence of either LSCOLOR (BSD) or LS_COLORS (GNU) and prefer which ever one is 'native' if both env vars are present.

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

No branches or pull requests

2 participants