From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/2] CLI: simplify help command
Date: Sun, 29 May 2022 15:22:03 -0300 [thread overview]
Message-ID: <20220529182204.1766073-1-david@tethera.net> (raw)
This will allow "notmuch help" to work for arbitrary external commands
and for any added non-command topics (such as notmuch-sexp-queries).
---
notmuch.c | 22 +++-------------------
1 file 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;
}
--
2.35.2
next reply other threads:[~2022-05-29 18:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-29 18:22 David Bremner [this message]
2022-05-29 18:22 ` [PATCH 2/2] CLI: mention sexp-queries in help topics, alphabetize David Bremner
2022-06-13 10:26 ` [PATCH 1/2] CLI: simplify help command David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220529182204.1766073-1-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).