mbornet-hl / hl

Highlight (colorize) text data using regular expressions (efficient C program)
Other
118 stars 9 forks source link

hl script removes itself from PATH and then calls hl... #15

Closed dfaure-kdab closed 3 years ago

dfaure-kdab commented 4 years ago

How is this supposed to work?

$ cd /d/more/src/tools/hl/hl_bin
$ export PATH=$PWD:$PATH
$ df
/d/more/src/tools/hl/hl_bin/df: line 48: hl: command not found
$ which hl
/d/more/src/tools/hl/hl_bin/hl

The hl script does:

PATH="$(echo "$PATH" | sed "s|^$dirname:||;s|:$dirname:|:|g")"
export PATH
mbornet-hl commented 4 years ago

The presence of an "hl" script in the hl_bin directory was a mistake : I removed it. The "df" script from the hl_bin directory is a link to the hl_generic script, which calls the original command ("df") and pipes its standard output and standard error output to two hl commands (via named pipes). So the output of the original "df" command is colorized with "hl --df".

dfaure-kdab commented 4 years ago

In a git checkout, "df" and friends are not symlinks, but actual files. Maybe it would be better to create those symlinks in the Makefile.

dfaure-kdab commented 4 years ago

Shouldn't the "hl" binary be created in the hl_bin directory so that this can all be used without installing? "hl" in the parent directory can't be found in $PATH.

Or if installing is mandatory, then the Makefile should support make install :-)

mbornet-hl commented 4 years ago

Since version 1.93, you can use hl without having to install it. You can configure module to update PATH, HL_CONF and HL_CONF_GLOB to suit your needs. You can leave the hl top directory wherever you want.