[systemd-devel] [systemd-commits] 5 commits - Makefile.am man/systemd.unit.xml src/bus-driverd src/libsystemd-bus src/shared src/systemctl

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Dec 17 06:59:33 PST 2013


On Tue, Dec 17, 2013 at 02:58:23PM +0100, Lennart Poettering wrote:
> On Mon, 16.12.13 20:28, Zbigniew Jędrzejewski-Szmek (zbyszek at kemper.freedesktop.org) wrote:
> 
> > commit c0fdf09885ce83cc7edc31f51b03ef284980dfa8
> > Author: Zbigniew J??drzejewski-Szmek <zbyszek at in.waw.pl>
> > Date:   Mon Dec 16 22:34:07 2013 -0500
> > 
> >     systemctl: highlight filenames in cat
> > 
> > diff --git a/src/shared/util.h b/src/shared/util.h
> > index 57689e9..dd51e89 100644
> > --- a/src/shared/util.h
> > +++ b/src/shared/util.h
> > @@ -64,6 +64,7 @@ union dirent_storage {
> >  #define ANSI_GREEN_ON "\x1B[32m"
> >  #define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
> >  #define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
> > +#define ANSI_HIGHLIGHT_BLUE_ON "\x1B[1;34m"
> >  #define ANSI_HIGHLIGHT_OFF "\x1B[0m"
> >  #define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
> >  
> > @@ -399,6 +400,10 @@ static inline const char *ansi_highlight_yellow(void) {
> >          return on_tty() ? ANSI_HIGHLIGHT_YELLOW_ON : "";
> >  }
> >  
> > +static inline const char *ansi_highlight_blue(void) {
> > +        return on_tty() ? ANSI_HIGHLIGHT_BLUE_ON : "";
> > +}
> > +
> >  static inline const char *ansi_highlight_off(void) {
> >          return on_tty() ? ANSI_HIGHLIGHT_OFF : "";
> >  }
> > diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
> > index 327eb85..aab92c4 100644
> > --- a/src/systemctl/systemctl.c
> > +++ b/src/systemctl/systemctl.c
> > @@ -3797,7 +3797,10 @@ static int cat(sd_bus *bus, char **args) {
> >                  }
> >  
> >                  if (!isempty(fragment_path)) {
> > -                        fprintf(stdout, "# %s\n", fragment_path);
> > +                        fprintf(stdout, "%s# %s%s\n",
> > +                                ansi_highlight_blue(),
> > +                                fragment_path,
> > +                                ansi_highlight_off());
> 
> Hmm, do we really want yet another color for this? In particular since
> blue is somewhat hard to see on black? 
> 
> I think sticking to traffic light colors + bold should be
> enough. Wouldn't ANI_HIGHLIGHT_ON work here nicely too?
I didn't use HIGHLIGHT because I didn't want to attract attention to
the line, and picked blue because it is low key. Let's leave it as is
for a few days to get used to blue, and if it still doens't work, then
I'll change it.

Zbyszek


More information about the systemd-devel mailing list