]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: seperate config file groups by underline
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Apr 2018 07:55:32 +0000 (09:55 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 7 May 2018 16:15:29 +0000 (18:15 +0200)
When multiple configuration file groups are shown together (e.g.
systemd-analyze cat-config systemd/system.conf systemd/user.conf), it's nice
to separate them visually.

I tried first to write a line of spaces and underline that. This does not look
too good, because the line is too low. Then I tried a block of blue-background
spaces. In this version, there are two lines, one is full of spaces and
underlined, so visually we get an empty line in the middle.

I then tried underlining the last line of the previous file. This does not look
right, unless the line is full width, i.e. unless spaces are written out until
the end of the line. But when those spaces are added, it's not clear if they
were part of the original file or not. Here, the spaces are between groups, so
it seems less likely that somebody will mistake those spaces for part of the
configuration file.

src/analyze/analyze.c

index 19e6e83c6ffde191d5fd0b86e6f62fae3eaa43d4..b6036acf1c9fe6cb4ca6647b00d58340cf227fcf 100644 (file)
@@ -1323,7 +1323,10 @@ static int cat_config(int argc, char *argv[], void *userdata) {
 
         STRV_FOREACH(arg, argv + 1) {
                 if (arg != argv + 1)
-                        puts("");
+                        printf("%s%*s%s\n\n",
+                               ansi_underline(),
+                               columns(), "",
+                               ansi_normal());
 
                 if (path_is_absolute(*arg)) {
                         log_error("Arguments must be config file names (relative to /etc/");