Hello all,
As subject says. OpenBSD grep doesn't support the --color option. Maybe
include a check to see if includes color and if not don't use it.
for example,
[[ $(grep --color=auto 2>/dev/null) ]] && alias grep='grep --color=auto'
Dylan
Le 24 nov 28 09:11, Dylan D'Silva a écrit :
>Hello all,>>As subject says. OpenBSD grep doesn't support the --color option. Maybe>include a check to see if includes color and if not don't use it.>for example,>[[ $(grep --color=auto 2>/dev/null) ]] && alias grep='grep --color=auto'>>Dylan
Hi Dylan,
This is very interesting as you are the first feedback I have from
Offpunk on OpenBSD (something I was hoping to see).
This definitely needs to be fixed in opnk..py, line 19.
I don’t see how to translate your bash check into python (I might be not
in a good condition to do it now).
Is there someone with an idea about the best way to check for options
from within Python?
--
Ploum - Lionel Dricot
Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Hey Ploum,
How about using subprocess?
import subprocess
results = subprocess.run(["grep", "--color=auto"], check=True)
if results == 0
...
else
...
Dylan
On Thu Nov 28, 2024 at 9:29 PM AEDT, Ploum wrote:
> Le 24 nov 28 09:11, Dylan D'Silva a écrit :> >Hello all,> >> >As subject says. OpenBSD grep doesn't support the --color option. Maybe> >include a check to see if includes color and if not don't use it.> >for example,> >[[ $(grep --color=auto 2>/dev/null) ]] && alias grep='grep --color=auto'> >> >Dylan>> Hi Dylan,>> This is very interesting as you are the first feedback I have from > Offpunk on OpenBSD (something I was hoping to see).>>> This definitely needs to be fixed in opnk..py, line 19. >> I don’t see how to translate your bash check into python (I might be not > in a good condition to do it now).>> Is there someone with an idea about the best way to check for options > from within Python?
Le 24 nov 28 10:06, Dylan D'Silva a écrit :
>Hey Ploum,>>How about using subprocess?>>import subprocess>>results = subprocess.run(["grep", "--color=auto"], check=True)>>if results == 0
Should be fixed in the Trunk.
(it was a bit harder than that because, to avoid failing, grep need both
an argument and a input to parse that should be binary. Thus adding
input=b"x")