mirror of https://github.com/skeeto/enchive.git
Drop built-in help command.
parent
3b71d656ee
commit
6d1407bf1f
|
@ -97,9 +97,6 @@ Delete the original input file after success.
|
|||
.TP
|
||||
.B fingerprint
|
||||
Print the public key fingerprint to standard output.
|
||||
.TP
|
||||
.B help
|
||||
Print help for a specific command.
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
|
|
52
src/docs.h
52
src/docs.h
|
@ -16,7 +16,6 @@ static const char *docs_usage[] = {
|
|||
" archive archive using the public key",
|
||||
" extract extract from an archive using the secret key",
|
||||
" fingerprint print the master keypair fingerprint",
|
||||
" help get help on a specific topic",
|
||||
"",
|
||||
#if ENCHIVE_OPTION_AGENT
|
||||
" --agent[=seconds] run the key agent after reading a passphrase ["
|
||||
|
@ -34,54 +33,3 @@ static const char *docs_usage[] = {
|
|||
"Enchive archives files by encrypting them to yourself using your",
|
||||
"public key. It uses ChaCha20, Curve25519, and HMAC-SHA256.",
|
||||
0};
|
||||
|
||||
static const char *docs_keygen[] = {
|
||||
"usage: enchive keygen [-d|--derive[=count]] [-e|--edit] [-f|--force]",
|
||||
" [-p|--plain] [-k|--iterations count]",
|
||||
" Generate a brand new keypair.",
|
||||
"",
|
||||
" --derive[=<n>] derive secret key from a passphrase ["
|
||||
STR(ENCHIVE_SECKEY_DERIVE_ITERATIONS) "]",
|
||||
" --edit edit the protection on an existing key",
|
||||
" --fingerprint print the master keypair fingerprint",
|
||||
" --iterations <n> iterations for protection key derivation ["
|
||||
STR(ENCHIVE_KEY_DERIVE_ITERATIONS)"]",
|
||||
" --force, -f overwrite any existing keys (default: no clobber)",
|
||||
" --plain, -u don't encrypt the secret key with a protection key",
|
||||
"",
|
||||
"The global --pubkey and --seckey options select the filenames.",
|
||||
0};
|
||||
|
||||
static const char *docs_fingerprint[] = {
|
||||
"usage: enchive fingerprint",
|
||||
" Print the master keypair fingerprint to standard output.",
|
||||
0};
|
||||
|
||||
static const char *docs_archive[] = {
|
||||
"usage: enchive archive [input [output]]",
|
||||
" Encrypt a single file for archival (only requires public key).",
|
||||
"",
|
||||
" --delete, -d delete input file after successful encryption",
|
||||
"",
|
||||
"If no output filename is given, an '.enchive' suffix is given to",
|
||||
"the input filename. The original file is untouched. If no",
|
||||
"filenames are given, Enchive will encrypt standard input to",
|
||||
"standard output.",
|
||||
0};
|
||||
|
||||
static const char *docs_extract[] = {
|
||||
"usage: enchive extract [input [output]]",
|
||||
" Extract a single file from archival (requires secret key).",
|
||||
"",
|
||||
" --delete, -d delete input file after successful decryption",
|
||||
"",
|
||||
"If no output filename is given, the '.enchive' suffix is removed",
|
||||
"from the input filename. It is an error for the input to lack an",
|
||||
".enchive suffix. If no filenames are given, Enchive will dencrypt",
|
||||
"standard input to standard output.",
|
||||
0};
|
||||
|
||||
static const char *docs_help[] = {
|
||||
"usage: enchive help [command]",
|
||||
" Provide help on a specific command",
|
||||
0};
|
||||
|
|
|
@ -927,12 +927,11 @@ enum command {
|
|||
COMMAND_KEYGEN,
|
||||
COMMAND_FINGERPRINT,
|
||||
COMMAND_ARCHIVE,
|
||||
COMMAND_EXTRACT,
|
||||
COMMAND_HELP
|
||||
COMMAND_EXTRACT
|
||||
};
|
||||
|
||||
static const char command_names[][12] = {
|
||||
"keygen", "fingerprint", "archive", "extract", "help"
|
||||
"keygen", "fingerprint", "archive", "extract"
|
||||
};
|
||||
|
||||
static enum command
|
||||
|
@ -1297,50 +1296,6 @@ multiputs(const char **s, FILE *f)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
command_help(struct optparse *options)
|
||||
{
|
||||
static const struct optparse_long help[] = {
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
char *command;
|
||||
|
||||
int option;
|
||||
while ((option = optparse_long(options, help, 0)) != -1) {
|
||||
switch (option) {
|
||||
default:
|
||||
fatal("%s", options->errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
command = optparse_arg(options);
|
||||
if (!command)
|
||||
command = "help";
|
||||
|
||||
switch (parse_command(command)) {
|
||||
case COMMAND_UNKNOWN:
|
||||
case COMMAND_AMBIGUOUS:
|
||||
fatal("unknown command -- %s\n", command);
|
||||
break;
|
||||
case COMMAND_KEYGEN:
|
||||
multiputs(docs_keygen, stdout);
|
||||
break;
|
||||
case COMMAND_FINGERPRINT:
|
||||
multiputs(docs_fingerprint, stdout);
|
||||
break;
|
||||
case COMMAND_ARCHIVE:
|
||||
multiputs(docs_archive, stdout);
|
||||
break;
|
||||
case COMMAND_EXTRACT:
|
||||
multiputs(docs_extract, stdout);
|
||||
break;
|
||||
case COMMAND_HELP:
|
||||
multiputs(docs_help, stdout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_usage(FILE *f)
|
||||
{
|
||||
|
@ -1447,9 +1402,6 @@ main(int argc, char **argv)
|
|||
case COMMAND_EXTRACT:
|
||||
command_extract(options);
|
||||
break;
|
||||
case COMMAND_HELP:
|
||||
command_help(options);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue