summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-11-15 11:54:57 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-11-15 11:54:57 +0100
commit45c0c61df3c63cb1f20505c8d292385d5e300578 (patch)
tree4cdfaeae4f2d51449543bf51dc07bda2db68a1ef /src/systemctl
parent48c2826b4ea686cd69e489f9c6fe2d9ddebb6a69 (diff)
systemctl: add help for --type/-t
The list of types and load states if lengthy, so a little reminder can be sometimes useful.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 39f4e6c509..f6eed1cc7f 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4058,6 +4058,22 @@ static int runlevel_help(void) {
return 0;
}
+static int help_types(void) {
+ int i;
+
+ puts("Available unit types:");
+ for(i = UNIT_SERVICE; i < _UNIT_TYPE_MAX; i++)
+ if (unit_type_table[i])
+ puts(unit_type_table[i]);
+
+ puts("\nAvailable unit load states: ");
+ for(i = UNIT_STUB; i < _UNIT_LOAD_STATE_MAX; i++)
+ if (unit_type_table[i])
+ puts(unit_load_state_table[i]);
+
+ return 0;
+}
+
static int systemctl_parse_argv(int argc, char *argv[]) {
enum {
@@ -4137,6 +4153,11 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return 0;
case 't':
+ if (streq(optarg, "help")) {
+ help_types();
+ return 0;
+ }
+
if (unit_type_from_string(optarg) >= 0) {
arg_type = optarg;
break;
@@ -4147,6 +4168,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
}
log_error("Unkown unit type or load state '%s'.",
optarg);
+ log_info("Use -t help to see a list of allowed values.");
return -EINVAL;
case 'p': {
char **l;