pki: Indent usage lines properly automatically
This commit is contained in:
+4
-4
@@ -191,7 +191,7 @@ void command_register(command_t command)
|
|||||||
int command_usage(char *error)
|
int command_usage(char *error)
|
||||||
{
|
{
|
||||||
FILE *out = stdout;
|
FILE *out = stdout;
|
||||||
int i;
|
int i, indent = 0;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -221,12 +221,12 @@ int command_usage(char *error)
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
fprintf(out, " pki --%s %s\n",
|
indent = fprintf(out, " pki --%s ", cmds[active].cmd);
|
||||||
cmds[active].cmd, cmds[active].line[i]);
|
fprintf(out, "%s\n", cmds[active].line[i]);
|
||||||
}
|
}
|
||||||
else
|
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++)
|
for (i = 0; cmds[active].options[i].name; i++)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ static void __attribute__ ((constructor))reg()
|
|||||||
{
|
{
|
||||||
command_register((command_t) {
|
command_register((command_t) {
|
||||||
gen, 'g', "gen", "generate a new private key",
|
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]"},
|
"[--shares n] [--threshold l] [--outform der|pem]"},
|
||||||
{
|
{
|
||||||
{"help", 'h', 0, "show usage information"},
|
{"help", 'h', 0, "show usage information"},
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ static void __attribute__ ((constructor))reg()
|
|||||||
command_register((command_t) {
|
command_register((command_t) {
|
||||||
req, 'r', "req",
|
req, 'r', "req",
|
||||||
"create a PKCS#10 certificate request",
|
"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]",
|
"[--san subjectAltName]+ [--password challengePassword]",
|
||||||
"[--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
|
"[--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
|
||||||
"[--outform der|pem]"},
|
"[--outform der|pem]"},
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ static void __attribute__ ((constructor))reg()
|
|||||||
command_register((command_t) {
|
command_register((command_t) {
|
||||||
self, 's', "self",
|
self, 's', "self",
|
||||||
"create a self signed certificate",
|
"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]+",
|
" --dn distinguished-name [--san subjectAltName]+",
|
||||||
"[--lifetime days] [--serial hex] [--ca] [--ocsp uri]+",
|
"[--lifetime days] [--serial hex] [--ca] [--ocsp uri]+",
|
||||||
"[--flag serverAuth|clientAuth|crlSign|ocspSigning|msSmartcardLogon]+",
|
"[--flag serverAuth|clientAuth|crlSign|ocspSigning|msSmartcardLogon]+",
|
||||||
|
|||||||
@@ -453,12 +453,12 @@ static void __attribute__ ((constructor))reg()
|
|||||||
sign_crl, 'c', "signcrl",
|
sign_crl, 'c', "signcrl",
|
||||||
"issue a CRL using a CA certificate and key",
|
"issue a CRL using a CA certificate and key",
|
||||||
{"--cacert file --cakey file|--cakeyid hex [--lifetime days]",
|
{"--cacert file --cakey file|--cakeyid hex [--lifetime days]",
|
||||||
" [--lastcrl crl] [--basecrl crl] [--crluri uri]+",
|
"[--lastcrl crl] [--basecrl crl] [--crluri uri]+",
|
||||||
" [[--reason key-compromise|ca-compromise|affiliation-changed|",
|
"[[--reason key-compromise|ca-compromise|affiliation-changed|",
|
||||||
" superseded|cessation-of-operation|certificate-hold]",
|
" superseded|cessation-of-operation|certificate-hold]",
|
||||||
" [--date timestamp] --cert file|--serial hex]*",
|
" [--date timestamp] --cert file|--serial hex]*",
|
||||||
" [--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
|
"[--digest md5|sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512]",
|
||||||
" [--outform der|pem]"},
|
"[--outform der|pem]"},
|
||||||
{
|
{
|
||||||
{"help", 'h', 0, "show usage information"},
|
{"help", 'h', 0, "show usage information"},
|
||||||
{"cacert", 'c', 1, "CA certificate file"},
|
{"cacert", 'c', 1, "CA certificate file"},
|
||||||
|
|||||||
Reference in New Issue
Block a user