]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pki: Indent usage lines properly automatically
authorTobias Brunner <tobias@strongswan.org>
Mon, 30 Oct 2017 13:55:44 +0000 (14:55 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 8 Nov 2017 15:48:10 +0000 (16:48 +0100)
src/pki/command.c
src/pki/commands/gen.c
src/pki/commands/req.c
src/pki/commands/self.c
src/pki/commands/signcrl.c

index ce704dbb82847cf2d95af8d31f297198a4e6b898..f425af7e8ecb2366932a7d913f95baf67d3fe610 100644 (file)
@@ -191,7 +191,7 @@ void command_register(command_t command)
 int command_usage(char *error)
 {
        FILE *out = stdout;
-       int i;
+       int i, indent = 0;
 
        if (error)
        {
@@ -221,12 +221,12 @@ int command_usage(char *error)
                {
                        if (i == 0)
                        {
-                               fprintf(out, "  pki --%s %s\n",
-                                               cmds[active].cmd, cmds[active].line[i]);
+                               indent = fprintf(out, "  pki --%s ", cmds[active].cmd);
+                               fprintf(out, "%s\n", cmds[active].line[i]);
                        }
                        else
                        {
-                               fprintf(out, "              %s\n", cmds[active].line[i]);
+                               fprintf(out, "%*s%s\n", indent, "", cmds[active].line[i]);
                        }
                }
                for (i = 0; cmds[active].options[i].name; i++)
index 6f14b5276b3f4a8773d68b513237f8bb3c9e9663..203c76542ac0dd9645f00b143ecacc94aa54ef93 100644 (file)
@@ -166,7 +166,7 @@ static void __attribute__ ((constructor))reg()
 {
        command_register((command_t) {
                gen, 'g', "gen", "generate a new private key",
-               {"  [--type rsa|ecdsa|ed25519|bliss] [--size bits] [--safe-primes]",
+               {"[--type rsa|ecdsa|ed25519|bliss] [--size bits] [--safe-primes]",
                 "[--shares n] [--threshold l] [--outform der|pem]"},
                {
                        {"help",                'h', 0, "show usage information"},
index 7b87e6ca6459b69d61e487d21a15516599df4fe3..57f381854fa6897eb459184be15a342b0d4d80e8 100644 (file)
@@ -208,7 +208,7 @@ static void __attribute__ ((constructor))reg()
        command_register((command_t) {
                req, 'r', "req",
                "create a PKCS#10 certificate request",
-               {"  [--in file|--keyid hex] [--type rsa|ecdsa|bliss|priv] --dn distinguished-name",
+               {"[--in file|--keyid hex] [--type rsa|ecdsa|bliss|priv] --dn distinguished-name",
                 "[--san subjectAltName]+ [--password challengePassword]",
                 "[--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
                 "[--outform der|pem]"},
index bdb22463eeb3dd9d7405a0b629e8240da327d4b7..64334838ee3a078ae02ecca0ffc49ef578b8e714 100644 (file)
@@ -441,7 +441,7 @@ static void __attribute__ ((constructor))reg()
        command_register((command_t) {
                self, 's', "self",
                "create a self signed certificate",
-               {" [--in file|--keyid hex] [--type rsa|ecdsa|ed25519|bliss|priv]",
+               {"[--in file|--keyid hex] [--type rsa|ecdsa|ed25519|bliss|priv]",
                 " --dn distinguished-name [--san subjectAltName]+",
                 "[--lifetime days] [--serial hex] [--ca] [--ocsp uri]+",
                 "[--flag serverAuth|clientAuth|crlSign|ocspSigning|msSmartcardLogon]+",
index 4c2e6df714ab744db5105191b31a8203863d6173..c7e103510abb4cc2c4e8ce696ccf4e789ba086da 100644 (file)
@@ -453,12 +453,12 @@ static void __attribute__ ((constructor))reg()
                sign_crl, 'c', "signcrl",
                "issue a CRL using a CA certificate and key",
                {"--cacert file --cakey file|--cakeyid hex [--lifetime days]",
-                "  [--lastcrl crl] [--basecrl crl] [--crluri uri]+",
-                "  [[--reason key-compromise|ca-compromise|affiliation-changed|",
-                "             superseded|cessation-of-operation|certificate-hold]",
-                "   [--date timestamp] --cert file|--serial hex]*",
-                "  [--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
-                "  [--outform der|pem]"},
+                "[--lastcrl crl] [--basecrl crl] [--crluri uri]+",
+                "[[--reason key-compromise|ca-compromise|affiliation-changed|",
+                "           superseded|cessation-of-operation|certificate-hold]",
+                " [--date timestamp] --cert file|--serial hex]*",
+                "[--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
+                "[--outform der|pem]"},
                {
                        {"help",                'h', 0, "show usage information"},
                        {"cacert",              'c', 1, "CA certificate file"},