]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
veritysetup: print help for --help/-h/help
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 31 Jul 2021 07:00:11 +0000 (09:00 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Aug 2021 14:02:54 +0000 (16:02 +0200)
In general our commands print help on --help, but here this would trigger
the error that two arguments are needed. Let's make this more user-friendly.

src/veritysetup/veritysetup.c

index 34208dcd87659e5da4501e169aa9856fd5344783..14d7462ddbce8dd7b5d2f91f980186608816f8d0 100644 (file)
@@ -130,7 +130,10 @@ static int run(int argc, char *argv[]) {
         _cleanup_(crypt_freep) struct crypt_device *cd = NULL;
         int r;
 
-        if (argc <= 1)
+        if (argc <= 1 ||
+            strv_contains(strv_skip(argv, 1), "--help") ||
+            strv_contains(strv_skip(argv, 1), "-h") ||
+            streq(argv[1], "help"))
                 return help();
 
         if (argc < 3)