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

[Feature request] color=auto mode #27

Open
tkapias opened this issue Mar 13, 2023 · 1 comment
Open

[Feature request] color=auto mode #27

tkapias opened this issue Mar 13, 2023 · 1 comment

Comments

@tkapias
Copy link

tkapias commented Mar 13, 2023

I would like to include hl in aliases to provide an output like color=auto in some binutils which lack colors.

But, it needs to detect that the output is in a pipe or not in a terminal and disable the coloration.

Manualy, I do it like that:

hlauto () {
  if [ -t 1 ]; then
    hl $1
  else
    cat -
  fi
}

alias df='df -Tha --total | hlauto --df'

It works great. The new alias df ouput in color, but df | less output without hl.

Would it be easy to include this feature in hl? Maybe like this?

alias df='df -Tha --total | color=auto hl --df'
@mbornet-hl
Copy link
Owner

Hello,
thank you for your suggestion, I've added this to my "to do" list, but I'm VERY busy at the moment.
I've just thought about it and I think I've found a simple way to do this.
But I need some time to implement and test it.

Regards,
Martial

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