diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 271f74ef6f..38c17606d7 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -200,6 +200,7 @@ COMMAND( "systemd-analyze\0", .abstract = "Profile systemd, show unit dependencies, check unit files.", .man_pages = "systemd-analyze.1\0", + .pager_flags = &arg_pager_flags, ); VERB_COMMON_HELP_AUTO_HIDDEN("systemd-analyze"); diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index 00a38b9367..ed0182950d 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -141,6 +141,7 @@ COMMAND( "--shift IMAGE UIDBASE\0", .man_pages = "systemd-dissect.1\0", .option_namespace = "systemd-dissect", + .pager_flags = &arg_pager_flags, ); static int parse_image_path_argument(const char *path, char **ret_root, char **ret_image) { diff --git a/src/home/homectl.c b/src/home/homectl.c index b2f2882c72..e5c2857134 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -183,6 +183,7 @@ COMMAND( "homectl\0", "Create, manipulate or inspect home directories.", .man_pages = "homectl.1\0", + .pager_flags = &arg_pager_flags, .flags = COMMAND_HELP_SEPARATE, /* the option table is very wide */ ); diff --git a/src/id128/id128.c b/src/id128/id128.c index a65ba3b66d..54d41b24c9 100644 --- a/src/id128/id128.c +++ b/src/id128/id128.c @@ -29,6 +29,7 @@ COMMAND( "systemd-id128\0", "Generate and print 128-bit identifiers.", .man_pages = "systemd-id128.1\0", + .pager_flags = &arg_pager_flags, ); static int print_id(sd_id128_t id) { diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index c774d93211..4336c4f90b 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -101,6 +101,7 @@ COMMAND( "resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.", .man_pages = "resolvectl.1\0", .option_namespace = "resolvectl", + .pager_flags = &arg_pager_flags, ); typedef enum StatusMode { @@ -3225,6 +3226,7 @@ COMMAND( "This command is deprecated. Use resolvectl.1 instead.", .man_pages = "resolvectl.1\0", .option_namespace = "systemd-resolve", + .pager_flags = &arg_pager_flags, ); static int compat_parse_argv(int argc, char *argv[], char ***remaining_args) { diff --git a/src/shared/verbs.c b/src/shared/verbs.c index d6804a9154..ec8bfaf518 100644 --- a/src/shared/verbs.c +++ b/src/shared/verbs.c @@ -9,6 +9,7 @@ #include "log.h" #include "nulstr-util.h" #include "options.h" +#include "pager.h" #include "pretty-print.h" #include "string-util.h" #include "strv.h" @@ -444,6 +445,9 @@ int _command_print_help( const CommandDescription *cmd = (const CommandDescription*) ASSERT_PTR(cmdverb->data); + if (cmd->pager_flags) + pager_open(*cmd->pager_flags); + if (cmd->argspec) NULSTR_FOREACH(spec, cmd->argspec) { _cleanup_free_ char *line = strjoin("[OPTION…] ", spec); diff --git a/src/shared/verbs.h b/src/shared/verbs.h index 7ae669dc8a..cbe5b4e9cb 100644 --- a/src/shared/verbs.h +++ b/src/shared/verbs.h @@ -17,6 +17,7 @@ typedef struct CommandDescription { const char *footer; /* optional footer to print right above man page links */ const char *man_pages; /* nulstr with man page names */ const char *option_namespace; /* to be used when the options are in a namespace */ + const PagerFlags *pager_flags; /* optional pointer to the runtime pager flags variable */ CommandFlags flags; } CommandDescription; diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 06595792bd..9926748cbc 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -183,6 +183,7 @@ COMMAND( "timedatectl\0", .abstract = "Query or change system time and date settings.", .man_pages = "timedatectl.1\0", + .pager_flags = &arg_pager_flags, ); VERB_DEFAULT_NOARG(verb_status, "status", "Show current time settings"); diff --git a/src/varlinkctl/varlinkctl.c b/src/varlinkctl/varlinkctl.c index dafda83152..2a1c9a1ce2 100644 --- a/src/varlinkctl/varlinkctl.c +++ b/src/varlinkctl/varlinkctl.c @@ -292,6 +292,7 @@ COMMAND( .man_pages = "varlinkctl.1\0", .footer = "With --exec, specify the command to invoke:\n" " varlinkctl --exec call ADDRESS METHOD PARAMS -- CMDLINE…", + .pager_flags = &arg_pager_flags, ); VERB(verb_info, "info", "ADDRESS", 2, 2, 0, "Show service information");