]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loginctl: add -P as short for --value --property=
authorRonan Pigott <rpigott@berkeley.edu>
Wed, 30 Sep 2020 06:51:08 +0000 (23:51 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 30 Sep 2020 08:25:06 +0000 (10:25 +0200)
src/login/loginctl.c

index bc4f25f41e8a514fc07a782283b448e8df00fd63..053bb601a235437bb7a6b3e5b8ee9fdf2f374f62 100644 (file)
@@ -1266,6 +1266,7 @@ static int help(int argc, char *argv[], void *userdata) {
                "  -H --host=[USER@]HOST    Operate on remote host\n"
                "  -M --machine=CONTAINER   Operate on local container\n"
                "  -p --property=NAME       Show only properties by this name\n"
+               "  -P NAME                  Equivalent to --value --property=NAME\n"
                "  -a --all                 Show all properties, including empty ones\n"
                "     --value               When showing properties, only print the value\n"
                "  -l --full                Do not ellipsize output\n"
@@ -1321,7 +1322,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hp:als:H:M:n:o:", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "hp:P:als:H:M:n:o:", options, NULL)) >= 0)
 
                 switch (c) {
 
@@ -1331,6 +1332,10 @@ static int parse_argv(int argc, char *argv[]) {
                 case ARG_VERSION:
                         return version();
 
+                case 'P':
+                        arg_value = true;
+                        _fallthrough_;
+
                 case 'p': {
                         r = strv_extend(&arg_property, optarg);
                         if (r < 0)