aboutsummaryrefslogtreecommitdiff
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-02 21:44:20 +0100
committerDavid Bremner <david@tethera.net>2021-07-03 20:27:33 -0300
commit8316fc3ca14b311b5147738d1a4244e613454d06 (patch)
tree0f13cd398560cb88ecec59bf71d038b764d11bbb /notmuch-show.c
parent1768b0c416ce1034a5726ff0037e5a605cb45ab6 (diff)
CLI/show: accept --sort
Add the command-line option --sort to the show command of the CLI notmuch interface, with the same possible values as the same option in notmuch search.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index 232557d5..c8f1a40f 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1249,8 +1249,13 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
bool single_message;
bool unthreaded = FALSE;
notmuch_status_t status;
+ int sort = NOTMUCH_SORT_NEWEST_FIRST;
notmuch_opt_desc_t options[] = {
+ { .opt_keyword = &sort, .name = "sort", .keywords =
+ (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
+ { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
+ { 0, 0 } } },
{ .opt_keyword = &format, .name = "format", .keywords =
(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
{ "text", NOTMUCH_FORMAT_TEXT },
@@ -1367,6 +1372,8 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
return EXIT_FAILURE;
}
+ notmuch_query_set_sort (query, sort);
+
/* Create structure printer. */
formatter = formatters[format];
sprinter = formatter->new_sprinter (notmuch, stdout);