@@ -104,6 +104,7 @@ static unsigned arg_iterations = 1;
104104static usec_t arg_base_time = USEC_INFINITY ;
105105static char * arg_unit = NULL ;
106106static JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF ;
107+ static bool arg_quiet = false;
107108
108109STATIC_DESTRUCTOR_REGISTER (arg_dot_from_patterns , strv_freep );
109110STATIC_DESTRUCTOR_REGISTER (arg_dot_to_patterns , strv_freep );
@@ -1361,7 +1362,7 @@ static int dot(int argc, char *argv[], void *userdata) {
13611362 " red = Conflicts\n"
13621363 " green = After\n" );
13631364
1364- if (on_tty ())
1365+ if (on_tty () && ! arg_quiet )
13651366 log_notice ("-- You probably want to process this output with graphviz' dot tool.\n"
13661367 "-- Try a shell pipeline like 'systemd-analyze dot | dot -Tsvg > systemd.svg'!\n" );
13671368
@@ -1713,7 +1714,8 @@ static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
17131714 if (set_put_strdup (& known , sys ) < 0 )
17141715 return log_oom ();
17151716
1716- k = load_kernel_syscalls (& kernel );
1717+ if (!arg_quiet )
1718+ k = load_kernel_syscalls (& kernel );
17171719
17181720 for (int i = 0 ; i < _SYSCALL_FILTER_SET_MAX ; i ++ ) {
17191721 const SyscallFilterSet * set = syscall_filter_sets + i ;
@@ -1727,6 +1729,9 @@ static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
17271729 first = false;
17281730 }
17291731
1732+ if (arg_quiet ) /* Let's not show the extra stuff in quiet mode */
1733+ return 0 ;
1734+
17301735 if (!set_isempty (known )) {
17311736 _cleanup_free_ char * * l = NULL ;
17321737 char * * syscall ;
@@ -1748,7 +1753,8 @@ static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
17481753 if (k < 0 ) {
17491754 fputc ('\n' , stdout );
17501755 fflush (stdout );
1751- log_notice_errno (k , "# Not showing unlisted system calls, couldn't retrieve kernel system call list: %m" );
1756+ if (!arg_quiet )
1757+ log_notice_errno (k , "# Not showing unlisted system calls, couldn't retrieve kernel system call list: %m" );
17521758 } else if (!set_isempty (kernel )) {
17531759 _cleanup_free_ char * * l = NULL ;
17541760 char * * syscall ;
@@ -1930,6 +1936,9 @@ static int dump_filesystems(int argc, char *argv[], void *userdata) {
19301936 first = false;
19311937 }
19321938
1939+ if (arg_quiet ) /* Let's not show the extra stuff in quiet mode */
1940+ return 0 ;
1941+
19331942 if (!set_isempty (known )) {
19341943 _cleanup_free_ char * * l = NULL ;
19351944 char * * filesystem ;
@@ -2452,9 +2461,8 @@ static int help(int argc, char *argv[], void *userdata) {
24522461 " unit-paths List load directories for units\n"
24532462 " exit-status [STATUS...] List exit status definitions\n"
24542463 " capability [CAP...] List capability definitions\n"
2455- " syscall-filter [NAME...] Print list of syscalls in seccomp\n"
2456- " filter\n"
2457- " filesystems [NAME...] Print list of filesystems\n"
2464+ " syscall-filter [NAME...] List syscalls in seccomp filters\n"
2465+ " filesystems [NAME...] List known filesystems\n"
24582466 " condition CONDITION... Evaluate conditions and asserts\n"
24592467 " verify FILE... Check unit files for correctness\n"
24602468 " calendar SPEC... Validate repetitive calendar time\n"
@@ -2463,12 +2471,10 @@ static int help(int argc, char *argv[], void *userdata) {
24632471 " timespan SPAN... Validate a time span\n"
24642472 " security [UNIT...] Analyze security of unit\n"
24652473 "\nOptions:\n"
2466- " -h --help Show this help\n"
24672474 " --recursive-errors=MODE Control which units are verified\n"
24682475 " --offline=BOOL Perform a security review on unit file(s)\n"
24692476 " --threshold=N Exit with a non-zero status when overall\n"
24702477 " exposure level is over threshold value\n"
2471- " --version Show package version\n"
24722478 " --security-policy=PATH Use custom JSON security policy instead\n"
24732479 " of built-in one\n"
24742480 " --json=pretty|short|off Generate JSON output of the security\n"
@@ -2491,6 +2497,9 @@ static int help(int argc, char *argv[], void *userdata) {
24912497 " --iterations=N Show the specified number of iterations\n"
24922498 " --base-time=TIMESTAMP Calculate calendar times relative to\n"
24932499 " specified time\n"
2500+ " -h --help Show this help\n"
2501+ " --version Show package version\n"
2502+ " -q --quiet Do not emit hints\n"
24942503 "\nSee the %s for details.\n" ,
24952504 program_invocation_short_name ,
24962505 ansi_highlight (),
@@ -2532,6 +2541,7 @@ static int parse_argv(int argc, char *argv[]) {
25322541 static const struct option options [] = {
25332542 { "help" , no_argument , NULL , 'h' },
25342543 { "version" , no_argument , NULL , ARG_VERSION },
2544+ { "quiet" , no_argument , NULL , 'q' },
25352545 { "order" , no_argument , NULL , ARG_ORDER },
25362546 { "require" , no_argument , NULL , ARG_REQUIRE },
25372547 { "root" , required_argument , NULL , ARG_ROOT },
@@ -2569,6 +2579,13 @@ static int parse_argv(int argc, char *argv[]) {
25692579 case 'h' :
25702580 return help (0 , NULL , NULL );
25712581
2582+ case ARG_VERSION :
2583+ return version ();
2584+
2585+ case 'q' :
2586+ arg_quiet = true;
2587+ break ;
2588+
25722589 case ARG_RECURSIVE_ERRORS :
25732590 if (streq (optarg , "help" )) {
25742591 DUMP_STRING_TABLE (recursive_errors , RecursiveErrors , _RECURSIVE_ERRORS_MAX );
@@ -2581,9 +2598,6 @@ static int parse_argv(int argc, char *argv[]) {
25812598 arg_recursive_errors = r ;
25822599 break ;
25832600
2584- case ARG_VERSION :
2585- return version ();
2586-
25872601 case ARG_ROOT :
25882602 r = parse_path_argument (optarg , /* suppress_root= */ true, & arg_root );
25892603 if (r < 0 )
0 commit comments