mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
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.
This commit is contained in:
parent
1768b0c416
commit
8316fc3ca1
1 changed files with 7 additions and 0 deletions
|
@ -1249,8 +1249,13 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
|
||||||
bool single_message;
|
bool single_message;
|
||||||
bool unthreaded = FALSE;
|
bool unthreaded = FALSE;
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
int sort = NOTMUCH_SORT_NEWEST_FIRST;
|
||||||
|
|
||||||
notmuch_opt_desc_t options[] = {
|
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 =
|
{ .opt_keyword = &format, .name = "format", .keywords =
|
||||||
(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
|
(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
|
||||||
{ "text", NOTMUCH_FORMAT_TEXT },
|
{ "text", NOTMUCH_FORMAT_TEXT },
|
||||||
|
@ -1367,6 +1372,8 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notmuch_query_set_sort (query, sort);
|
||||||
|
|
||||||
/* Create structure printer. */
|
/* Create structure printer. */
|
||||||
formatter = formatters[format];
|
formatter = formatters[format];
|
||||||
sprinter = formatter->new_sprinter (notmuch, stdout);
|
sprinter = formatter->new_sprinter (notmuch, stdout);
|
||||||
|
|
Loading…
Reference in a new issue