diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-10-12 16:33:01 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-10-24 15:59:34 +0200 |
commit | 063c8382068b4cb8661aa5a77b6c7d117d0bd117 (patch) | |
tree | 6523e23b3f97d4da1b81da14c8f2086132d25644 /src/sysusers | |
parent | shared/pretty-print: drop unused flag (diff) | |
download | systemd-063c8382068b4cb8661aa5a77b6c7d117d0bd117.tar.xz systemd-063c8382068b4cb8661aa5a77b6c7d117d0bd117.zip |
analyze/cat-config: add switch to print only "interesting" parts of config files
When looking at configuration, often a user wants to suppress the comments and
just look at the parts that actually configure something, roughly equivalent to
systemd-analyze cat-config … | rg -v '^(#|;|$)
This switch implements this natively, skipping lines that start with a comment
character or only contain whitespace.
For formats that have section headers, section headers are skipped, if only
followed by stuff that would be skipped. (The last section header is printed
when we're about to print some actual output.)
Note that the caller doesn't know if the format has headers or not. We do format
type detection in pretty-print.c. So the caller only specifies tldr=true|false, and
conf_files_cat() figures out if the format has headers and whether those should
be handled specially.
The comments that show the file name are always printed, even if all of the file
is suppressed.
This is a partial answer to the discussions in
https://github.com/systemd/systemd/pull/28919,
https://github.com/systemd/systemd/pull/29248. If the default config is shown in
config files, the user can conveniently use '--tldr' to show the relevant parts.
Diffstat (limited to 'src/sysusers')
-rw-r--r-- | src/sysusers/sysusers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 0fcbf261c1..d996583cbd 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -2044,7 +2044,7 @@ static int cat_config(void) { pager_open(arg_pager_flags); - return cat_files(NULL, files, 0); + return cat_files(NULL, files, /* flags= */ 0); } static int help(void) { |