Closed johanneshoetzer closed 8 years ago
Hello Johannes,
thank you for your comment. At the present time, hl needs options to be passed in a specific order, which is : "color intensity option" (optional), then "color option" (mandatory), then "regular expression" (mandatory), so I'm used to pass the options the way you can see they are specified in the configuration files (/etc/default/hl and $HOME/.hl.cfg), so in your case, I would write :
ls | ./hl -2b Make
(more exactly I'll type :
ls | hl -2b Make
since my hl command has been copied in /usr/local/bin, which is in my PATH variable ;-) ).
When I have some time, I'll modify the arguments decoding program so that it will be possible to type :
ls | ./hl -b2 Make
What do you mean by "add a default color so hl directly works without parameters" ? If you don't specify any parameter, hl won't colorize anything because it needs to know which text must be colorized, according to the specified regular expressions. Without parameters also means without any regular expression.
Maybe you mean "so hl directly works without color specifier option", which in your case would lead to the following command :
ls | ./hl Make
with color "2b" specified in an environment variable (HL_DEFAULT, for example) ? Is this what you mean ?
Best regards,
Martial Bornet
On 10/10/2015 02:09 PM, johanneshoetzer wrote:
Hello,
i really like your hl tool, but the parameter seams to be given in a definded order: e.g. works ls | ./hl -2 -b Make cr_cpri.h cr_epri.h ...
but switching b and 2 does not work.
ls | ./hl -b -2 ak ./hl: missing argument for "-b" ! ARGS : opts = "hHuVvEr:g:y:b:m:c:w:R:G:Y:B:M:C:W:n:DLdei1234%.:" optarg = "(null)" curr_ptrs = 0x21f1040 PTRS : curr_arg = "-b" curr_idx = 2 next_arg = "(null)" prev = (nil) config = (nil)
I would also suggest to add a default color so hl directly works without parameters.
best regards, Johannes
— Reply to this email directly or view it on GitHub https://github.com/mbornet-hl/hl/issues/1.
thx, thats perfect. hope you will contiune that great tool!
Hello Johannes,
I've just pushed version 1.63 of hl which has a light syntax and handles the default color in the environment variable HL_DEFAULT. The man page hl(1) has been updated with this new syntax. Is that what you wanted ?
Best regards,
Martial Bornet
On 10/11/15 18:57, johanneshoetzer wrote:
thx, thats perfect. hope you will contiune that great tool!
— Reply to this email directly or view it on GitHub https://github.com/mbornet-hl/hl/issues/1#issuecomment-147221053.
Hey,
thx, yes works great. Thank you very much.
have you thought to set a default even if HL_DEFAULT is not specified?
by reading your code, i have seen you are using your own parameter parsing code. There are some god libaries, may be this helps solving the ordering issue: http://stackoverflow.com/questions/9642732/parsing-command-line-arguments
best regards, Johannes
I could not use the standard "getopt()" function, because I needed to deal with different levels of arguments, since you can use a config name inside a config definition, and you cannot modify argc/argv in the standard getopt(). The function I (quickly) wrote is not perfect, but it works as long as you conform to the syntax.
Hello,
i really like your hl tool, but the parameter seams to be given in a definded order: e.g. works ls | ./hl -2 -b Make cr_cpri.h cr_epri.h ...
but switching b and 2 does not work.
ls | ./hl -b -2 ak ./hl: missing argument for "-b" ! ARGS : opts = "hHuVvEr:g:y:b:m:c:w:R:G:Y:B:M:C:W:n:DLdei1234%.:" optarg = "(null)" curr_ptrs = 0x21f1040 PTRS : curr_arg = "-b" curr_idx = 2 next_arg = "(null)" prev = (nil) config = (nil)
I would also suggest to add a default color so hl directly works without parameters.
best regards, Johannes