From 92462517a1197b4d19b452dfccb5cee9746cd8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 24 Jul 2026 20:28:33 +0200 Subject: [PATCH] systemd-ask-password: convert to VERB_COMMAND --- src/ask-password/ask-password.c | 39 +++++++-------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/src/ask-password/ask-password.c b/src/ask-password/ask-password.c index fd0def44f1..4f75a94c39 100644 --- a/src/ask-password/ask-password.c +++ b/src/ask-password/ask-password.c @@ -9,20 +9,18 @@ #include "build.h" #include "bus-polkit.h" #include "constants.h" -#include "format-table.h" #include "hashmap.h" #include "json-util.h" #include "log.h" #include "main-func.h" -#include "options.h" #include "parse-argument.h" -#include "pretty-print.h" #include "string-table.h" #include "string-util.h" #include "strv.h" #include "time-util.h" #include "varlink-io.systemd.AskPassword.h" #include "varlink-util.h" +#include "verbs.h" static const char *arg_icon = NULL; static const char *arg_id = NULL; /* identifier for 'ask-password' protocol */ @@ -38,35 +36,14 @@ static bool arg_varlink = false; STATIC_DESTRUCTOR_REGISTER(arg_message, freep); -static int help(void) { - _cleanup_free_ char *link = NULL; - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = terminal_urlify_man("systemd-ask-password", "1", &link); - if (r < 0) - return log_oom(); - - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - printf("%s [OPTIONS...] MESSAGE\n" - "\n%sQuery the user for a passphrase, via the TTY or a UI agent.%s\n" - "\nOptions:\n", - program_invocation_short_name, - ansi_highlight(), - ansi_normal()); - r = table_print_or_warn(options); - if (r < 0) - return r; - - printf("\nSee the %s for details.\n", link); - return 0; -} +COMMAND( + "systemd-ask-password\0", + "Query the user for a passphrase, via the TTY or a UI agent.", + .argspec = "MESSAGE\0", + .man_pages = "systemd-ask-password.1\0", +); static int parse_argv(int argc, char *argv[]) { - const char *emoji = NULL; int r; @@ -78,7 +55,7 @@ static int parse_argv(int argc, char *argv[]) { FOREACH_OPTION_OR_RETURN(c, &opts) switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-ask-password"); OPTION_COMMON_VERSION: return version();