* [PATCH 1/2] CLI: simplify help command
@ 2022-05-29 18:22 David Bremner
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
0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2022-05-29 18:22 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] CLI: mention sexp-queries in help topics, alphabetize
2022-05-29 18:22 [PATCH 1/2] CLI: simplify help command David Bremner
@ 2022-05-29 18:22 ` David Bremner
2022-06-13 10:26 ` [PATCH 1/2] CLI: simplify help command David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-05-29 18:22 UTC (permalink / raw)
To: notmuch
There does not seem to be an easy way to automate maintaining this
list, but new topics are not added very often.
---
notmuch.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/notmuch.c b/notmuch.c
index c39fcfb2..68a785e2 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -211,12 +211,14 @@ typedef struct help_topic {
} help_topic_t;
static const help_topic_t help_topics[] = {
- { "search-terms",
- "Common search term syntax." },
{ "hooks",
"Hooks that will be run before or after certain commands." },
{ "properties",
"Message property conventions and documentation." },
+ { "search-terms",
+ "Common infix search term syntax." },
+ { "sexp-queries",
+ "Common s-expression search term syntax." },
};
static const command_t *
--
2.35.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] CLI: simplify help command
2022-05-29 18:22 [PATCH 1/2] CLI: simplify help command David Bremner
2022-05-29 18:22 ` [PATCH 2/2] CLI: mention sexp-queries in help topics, alphabetize David Bremner
@ 2022-06-13 10:26 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-06-13 10:26 UTC (permalink / raw)
To: notmuch
David Bremner <david@tethera.net> writes:
> This will allow "notmuch help" to work for arbitrary external commands
> and for any added non-command topics (such as notmuch-sexp-queries).
series applied to master
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-13 10:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 18:22 [PATCH 1/2] CLI: simplify help command David Bremner
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
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).