aboutsummaryrefslogtreecommitdiff
path: root/notmuch.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-05-29 15:22:03 -0300
committerDavid Bremner <david@tethera.net>2022-06-13 07:17:59 -0300
commit52470ddfbfaeac8e5530e32d45bd6259d4326517 (patch)
tree65e418d6ca9580f0cab367adf4a6e1c094560b1e /notmuch.c
parent3a6b479a7360fbdbc1c6def4c1e1581bfd63e8a2 (diff)
CLI: simplify help command
This will allow "notmuch help" to work for arbitrary external commands and for any added non-command topics (such as notmuch-sexp-queries).
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/notmuch.c b/notmuch.c
index ac25ae18..c39fcfb2 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -329,9 +329,7 @@ exec_man (const char *page)
static int
_help_for (const char *topic_name)
{
- const command_t *command;
- const help_topic_t *topic;
- unsigned int i;
+ char *page;
if (! topic_name) {
printf ("The notmuch mail system.\n\n");
@@ -348,23 +346,9 @@ _help_for (const char *topic_name)
return EXIT_SUCCESS;
}
- command = find_command (topic_name);
- if (command) {
- char *page = talloc_asprintf (NULL, "notmuch-%s", command->name);
- exec_man (page);
- }
-
- for (i = 0; i < ARRAY_SIZE (help_topics); i++) {
- topic = &help_topics[i];
- if (strcmp (topic_name, topic->name) == 0) {
- char *page = talloc_asprintf (NULL, "notmuch-%s", topic->name);
- exec_man (page);
- }
- }
+ page = talloc_asprintf (NULL, "notmuch-%s", topic_name);
+ exec_man (page);
- fprintf (stderr,
- "\nSorry, %s is not a known command. There's not much I can do to help.\n\n",
- topic_name);
return EXIT_FAILURE;
}