veritysetup: print help for --help/-h/help

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-08-03 16:02:54 +02:00
parent c7cfde640d
commit 5d5e43cc33
+4 -1
View 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)