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".)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-05-12 14:49:01 +02:00
parent 9bd3f4297d
commit e7d07c2035
7 changed files with 18 additions and 12 deletions
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
+6
View File
@@ -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)")
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}