diff options
author | mbornet-hl <mbornet.pro@wanadoo.fr> | 2015-07-28 16:14:31 +0200 |
---|---|---|
committer | mbornet-hl <mbornet.pro@wanadoo.fr> | 2015-07-28 16:14:31 +0200 |
commit | a3fb01beff590770c153f35b43686c97c004c588 (patch) | |
tree | 5765c492cc9862370fe4ee1e3e4a103304d9c5ad | |
parent | 47da5c63ce0de395553e68236f54bbc4762897ea (diff) | |
download | hl-a3fb01beff590770c153f35b43686c97c004c588.zip hl-a3fb01beff590770c153f35b43686c97c004c588.tar.gz hl-a3fb01beff590770c153f35b43686c97c004c588.tar.bz2 |
Updated man page and command's usage.
-rw-r--r-- | man1/hl.1 | 64 | ||||
-rw-r--r-- | src/cr_main.c | 13 |
2 files changed, 59 insertions, 18 deletions
@@ -1,20 +1,24 @@ -.\" @(#) [MB] cr_hl.1 Version 1.3 du 15/04/06 - -.TH "HL" "1" "April 2015" "" "User Commands" +.\" @(#) [MB] cr_hl.1 Version 1.4 du 15/07/28 - +.TH "HL" "1" "July 2015" "" "User Commands" .SH "NAME" hl - Colorize strings matching regular expressions .SH "SYNOPSIS" .PP -\fBhl\fP [\fBoptions\fP] +\fBhl\fP \fB [-h|-H|-V|-[eiuvdDEL1234][-[rgybmcwRGYBMCW] regexp ...][--config_name ...] ]\fP + .SH "DESCRIPTION" .PP \fBhl\fP -Colorize strings from standard input with different colors, -each color being associated with one regular expression. +reads standard input and colorize strings matching regular expressions with specified colors. .SH "OPTIONS" .IP "\fB-h\fP " 10 display help message -.IP "\fB-v\fP " 10 +.IP "\fB-H\fP " 10 +display help message and configuration names found in $HOME/.hl.cfg +.IP "\fB-V\fP " 10 display version information and exit +.IP "\fB-v\fP " 10 +verbose .IP "\fB-u\fP " 10 does not bufferize output on stdout .IP "\fB-e\fP " 10 @@ -63,6 +67,20 @@ display strings matching the associated regular expression in white activate debug .IP "\fB-D\fP " 10 display specified regular expressions +.IP "\fB-L\fP " 10 +lex debug +.IP "\fB-1\fP " 10 +color brightness (half bright). +Changes the brightness of all the following colors, until another brightness is specified. +.IP "\fB-2\fP " 10 +color brightness (normal : default). +Changes the brightness of all the following colors, until another brightness is specified. +.IP "\fB-3\fP " 10 +color brightness (bright). +Changes the brightness of all the following colors, until another brightness is specified. +.IP "\fB-4\fP " 10 +color brightness (underscore). +Changes the brightness of all the following colors, until another brightness is specified. .SH "PRIORITIES" A color specifier always has a higher priority than the one that follows. @@ -76,6 +94,10 @@ will colorize each "a" in red and each "b" in green, while the following one : will colorize each letter in green. +.SH "PARENTHESIS" +If no parenthesis are specified in the regular expression, then all characters matching the regexp will be colorized. +If parenthesis are specified, only characters captured in the parenthesis will be colorized. + .SH "EXAMPLES" .TP Example 1 : @@ -100,18 +122,42 @@ will display 192.168.266.1 in red and 192.168.26.1 in green. .TP Example 3 : -.B dpkg -l | hl -ei -Er '.*systemd\>.*' -Eg '.*(sysvinit|system-v-).*' > /dev/null +.B dpkg -l | hl -ei -Er '.*systemd\>.*' -Eg '(.*(sysvinit|system-v-).*)' > /dev/null On Debian, this command will list the packages whose description line contains strings containing the word "systemd" in red, and lines containing "sysvinit" or "system-v-" in green, whatever the case. +.TP +Example 4 : +.B /sbin/ifconfig -a | hl --ifconfig + +Colorize the output of the ifconfig command according to the configuration \fBifconfig\fP specified in the configuration file. + +.TP +Example 5 : +.B df -h | hl --df + +Colorize the output of the df command according to the configuration \fBdf\fP specified in the configuration file. + +.TP +Example 6 : +.B /sbin/ifconfig -a | hl --IP --MAC --eth + + +Colorize the output of the ifconfig command according to the configurations \fBIP\fP, \fBMAC\fP and \fBeth\fP specified in the configuration file. + +.SH "FILES" +.TP +The \fBhl\fP command can use a configuration file named \fB$HOME/.hl.cfg\fP . + .SH "MAN PAGE VERSION" -The version of this man page is 1.3. -It is compatible with hl version 1.22. +The version of this man page is 1.4. +It is compatible with hl version 1.42 and upper. .SH "AUTHOR" .PP The original version of this manual page was written by Martial Bornet <mbornet (.) pro (at) wanadoo (.) fr> for the \fBGNU/Linux\fP system. + Permission is granted to copy, distribute and/or modify this document under the terms of the GNU GPL. diff --git a/src/cr_main.c b/src/cr_main.c index 06bcfb6..6677f27 100644 --- a/src/cr_main.c +++ b/src/cr_main.c @@ -20,7 +20,7 @@ * * Fichier : cr_main.c * - * @(#) [MB] cr_main.c Version 1.42 du 15/07/27 - + * @(#) [MB] cr_main.c Version 1.43 du 15/07/28 - * * Liste des fonctions de ce fichier : * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -181,11 +181,9 @@ bool cr_needs_arg(char opt, struct cr_args *args) { int _i; -//printf("needs_args(%c, %s) ...\n", opt, args->opts); for (_i = 0; args->opts[_i] != 0; _i++) { if (args->opts[_i] != opt) continue; if (args->opts[_i + 1] == ':') { -// printf(" => YES\n"); return TRUE; } else { @@ -193,7 +191,6 @@ bool cr_needs_arg(char opt, struct cr_args *args) } } -// printf(" => NO\n"); return FALSE; } @@ -213,7 +210,6 @@ struct cr_config *cr_get_config(char *config_name, struct cr_args *args) for (_config = args->configs->extract; _config != 0; _config = _config->next) { if (!strcmp(config_name, _config->name)) { -// fprintf(stderr, "Config found !\n"); break; } } @@ -488,7 +484,6 @@ int main(int argc, char *argv[]) } cr_init_list(); -// cr_init_col_names(); G.intensity = CR_DEFLT_INTENSITY; /* Analyse des arguments @@ -596,7 +591,7 @@ int main(int argc, char *argv[]) break; case 'V': - fprintf(stderr, "%s: version %s\n", G.prgname, "1.42"); + fprintf(stderr, "%s: version %s\n", G.prgname, "1.43"); exit(1); break; @@ -636,8 +631,8 @@ int main(int argc, char *argv[]) ******************************************************************************/ void cr_usage(bool disp_config) { - fprintf(stderr, "%s: version %s\n", G.prgname, "1.42"); - fprintf(stderr, "Usage: %s [-h|-H|-eidDL1234][-E][-rgybmcwRGYBMCW|--config_name] regexp ...\n", + fprintf(stderr, "%s: version %s\n", G.prgname, "1.43"); + fprintf(stderr, "Usage: %s [-h|-H|-V|-[eiuvdDEL1234][-[rgybmcwRGYBMCW] regexp ...][--config_name ...] ]\n", G.prgname); fprintf(stderr, " -h : help\n"); fprintf(stderr, " -H : help + configuration names\n"); |