From: Zbigniew Jędrzejewski-Szmek Date: Tue, 12 May 2026 11:58:47 +0000 (+0200) Subject: shared/options: add OPTION_COMMON_{SYSTEM,USER} X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7d07c20351cbce5ed179b0bf3ca29765d5d005d;p=thirdparty%2Fsystemd.git shared/options: add OPTION_COMMON_{SYSTEM,USER} We have different help strings for --user/--system in different places, so this only covers a subset of --system/--user instances. But this particular help seems to be the most widely used. (In a few cases, the help string is fixed: it should be "system mode", not "per-system mode".) --- diff --git a/src/import/export.c b/src/import/export.c index a77333643c6..8b64b9cad90 100644 --- a/src/import/export.c +++ b/src/import/export.c @@ -263,11 +263,11 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { return log_error_errno(arg_class, "Failed to parse --class= argument: %s", opts.arg); break; - OPTION_LONG("system", NULL, "Operate in per-system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in per-user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; } diff --git a/src/import/import-fs.c b/src/import/import-fs.c index 513a2c62d39..cc6e14c995a 100644 --- a/src/import/import-fs.c +++ b/src/import/import-fs.c @@ -370,11 +370,11 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { return log_error_errno(arg_class, "Failed to parse --class= argument: %s", opts.arg); break; - OPTION_LONG("system", NULL, "Operate in per-system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in per-user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; } diff --git a/src/import/import.c b/src/import/import.c index 798b6b743a2..9ddc4469c1f 100644 --- a/src/import/import.c +++ b/src/import/import.c @@ -410,11 +410,11 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { return log_error_errno(arg_class, "Failed to parse --class= argument: %s", opts.arg); break; - OPTION_LONG("system", NULL, "Operate in per-system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in per-user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; } diff --git a/src/import/pull.c b/src/import/pull.c index 6a1f913ff8a..ac9492f1775 100644 --- a/src/import/pull.c +++ b/src/import/pull.c @@ -537,11 +537,11 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { auto_keep_download = false; break; - OPTION_LONG("system", NULL, "Operate in per-system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in per-user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; } diff --git a/src/shared/options.h b/src/shared/options.h index 1f28dab8ad5..f88275821a6 100644 --- a/src/shared/options.h +++ b/src/shared/options.h @@ -124,6 +124,12 @@ typedef struct Option { #define OPTION_COMMON_MACHINE \ OPTION('M', "machine", "CONTAINER", "Operate on local container") +#define OPTION_COMMON_SYSTEM \ + OPTION_LONG("system", NULL, "Operate in system mode") + +#define OPTION_COMMON_USER \ + OPTION_LONG("user", NULL, "Operate in per-user mode") + #define OPTION_COMMON_JSON \ OPTION_LONG("json", "FORMAT", "Generate JSON output (pretty, short, or off)") diff --git a/src/storage/storage-fs.c b/src/storage/storage-fs.c index 167b10dd835..5b2bc415fb6 100644 --- a/src/storage/storage-fs.c +++ b/src/storage/storage-fs.c @@ -777,11 +777,11 @@ static int parse_argv(int argc, char *argv[]) { OPTION_COMMON_VERSION: return version(); - OPTION_LONG("system", NULL, "Operate in system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; } diff --git a/src/storage/storagectl.c b/src/storage/storagectl.c index bbe09e01b1d..d3ae3f91453 100644 --- a/src/storage/storagectl.c +++ b/src/storage/storagectl.c @@ -433,11 +433,11 @@ static int parse_argv(int argc, char *argv[], char ***args) { arg_ask_password = false; break; - OPTION_LONG("system", NULL, "Operate in system mode"): + OPTION_COMMON_SYSTEM: arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; break; - OPTION_LONG("user", NULL, "Operate in user mode"): + OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; }