* help: generate help texts from text file / awk
This commit is contained in:
@ -466,76 +466,20 @@ get_option_group (MuConfigCmd cmd)
|
||||
|
||||
|
||||
|
||||
|
||||
static const gchar*
|
||||
cmd_help (MuConfigCmd cmd, gboolean long_help)
|
||||
{
|
||||
unsigned u;
|
||||
|
||||
static const struct {
|
||||
MuConfigCmd cmd;
|
||||
const char *usage;
|
||||
const char *long_help;
|
||||
} help_strings[] = {
|
||||
{ MU_CONFIG_CMD_ADD,
|
||||
"mu add <file> [<files>]",
|
||||
"mu add is the command to add specific measage files to the\n"
|
||||
"database. Each of the files must be specified with an "
|
||||
"absolute path." },
|
||||
{ MU_CONFIG_CMD_CFIND,
|
||||
"mu cfind [options] [<pattern>]",
|
||||
"mu cfind is the mu command to find contacts in the mu\n"
|
||||
"database and export them for use in other programs." },
|
||||
{ MU_CONFIG_CMD_EXTRACT,
|
||||
"mu extract [options] <file>\n"
|
||||
"mu extract [options] <file> <pattern>",
|
||||
"mu extract is the mu command to display and save message parts "
|
||||
"(attachments)\n, and open them with other tools." },
|
||||
{ MU_CONFIG_CMD_FIND,
|
||||
"mu find [options] <search expression>",
|
||||
"mu find is the mu command for searching e-mail message that were "
|
||||
"stored earlier using mu index(1)." },
|
||||
{ MU_CONFIG_CMD_HELP,
|
||||
"mu help <command>",
|
||||
"mu find is the mu command to get help about <command>." },
|
||||
{ MU_CONFIG_CMD_INDEX,
|
||||
"mu index [options]",
|
||||
"mu index is the mu command for scanning the contents of Maildir "
|
||||
"directories\nand storing the results in a Xapian database.\n\nThe "
|
||||
"data can then be queried using mu-find(1)."},
|
||||
{ MU_CONFIG_CMD_MKDIR,
|
||||
"mu mkdir [options] <dir> [<dirs>]",
|
||||
"mu mkdir is the mu command for creating Maildirs.\nIt does not "
|
||||
"use the mu database. "},
|
||||
{ MU_CONFIG_CMD_REMOVE,
|
||||
"mu remove [options] <file> [<files>]",
|
||||
"mu remove is the mu command to remove messages from the database." },
|
||||
{ MU_CONFIG_CMD_SERVER,
|
||||
"mu server [options]",
|
||||
"mu server starts a simple shell in which one can query and "
|
||||
"manipulate the mu database.\nThe output of the commands is terms "
|
||||
"of Lisp symbolic expressions (s-exps).\nmu server is not meant for "
|
||||
"use by humans; instead, it is designed specifically\nfor the "
|
||||
"mu4e e-mail client." },
|
||||
{ MU_CONFIG_CMD_VERIFY,
|
||||
"mu verify [options] <msgfile>",
|
||||
"mu verify is the mu command for verifying message signatures "
|
||||
"(such as PGP/GPG signatures)\nand displaying information about them."
|
||||
"\n\nThe command works on message files, and does not require "
|
||||
"the message to be indexed in the database."},
|
||||
{ MU_CONFIG_CMD_VIEW,
|
||||
"mu view [options] <file> [<files>]",
|
||||
"mu view is the mu command for displaying e-mail message files. It "
|
||||
"works on message files and does \fInot\fR require the message to be "
|
||||
"indexed in the database."}
|
||||
};
|
||||
/* this include gets us MU_HELP_STRINGS */
|
||||
#include "mu-help-strings.h"
|
||||
|
||||
for (u = 0; u != G_N_ELEMENTS(help_strings); ++u)
|
||||
if (cmd == help_strings[u].cmd) {
|
||||
for (u = 0; u != G_N_ELEMENTS(MU_HELP_STRINGS); ++u)
|
||||
if (cmd == MU_HELP_STRINGS[u].cmd) {
|
||||
if (long_help)
|
||||
return help_strings[u].long_help;
|
||||
return MU_HELP_STRINGS[u].long_help;
|
||||
else
|
||||
return help_strings[u].usage ;
|
||||
return MU_HELP_STRINGS[u].usage ;
|
||||
}
|
||||
|
||||
g_return_val_if_reached ("");
|
||||
@ -543,7 +487,10 @@ cmd_help (MuConfigCmd cmd, gboolean long_help)
|
||||
}
|
||||
|
||||
|
||||
/* ugh yuck massaging of the GOption text output */
|
||||
/* ugh yuck massaging the GOption text output; glib prepares some text
|
||||
* which has a 'Usage:' for the 'help' commmand. However, we need the
|
||||
* help for the command we're asking help for. So, we remove the Usage:
|
||||
* from what glib generates. :-( */
|
||||
static gchar*
|
||||
massage_help (const char *help)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user