mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
Print nothing when search result is empty
This change affects both text and json formats. Now, text format
behaves as before commit 6dcb7592
, but json format is changed.
Earlier, the empty search returned '[]', now it returns ''. The emacs
interface seems not to be affected by this change.
This commit is contained in:
parent
c6b59ea3c6
commit
772bde847c
1 changed files with 12 additions and 6 deletions
|
@ -189,7 +189,9 @@ do_search_threads (const void *ctx,
|
|||
{
|
||||
int first_tag = 1;
|
||||
|
||||
if (! first_thread)
|
||||
if (first_thread)
|
||||
fputs (format->results_start, stdout);
|
||||
else
|
||||
fputs (format->item_sep, stdout);
|
||||
|
||||
thread = notmuch_threads_get (threads);
|
||||
|
@ -235,6 +237,9 @@ do_search_threads (const void *ctx,
|
|||
notmuch_thread_destroy (thread);
|
||||
}
|
||||
|
||||
if (! first_thread)
|
||||
fputs (format->results_end, stdout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -258,7 +263,9 @@ do_search_messages (const void *ctx,
|
|||
{
|
||||
message = notmuch_messages_get (messages);
|
||||
|
||||
if (! first_message)
|
||||
if (first_message)
|
||||
fputs (format->results_start, stdout);
|
||||
else
|
||||
fputs (format->item_sep, stdout);
|
||||
|
||||
if (output == OUTPUT_FILES) {
|
||||
|
@ -276,6 +283,9 @@ do_search_messages (const void *ctx,
|
|||
|
||||
notmuch_messages_destroy (messages);
|
||||
|
||||
if (! first_message)
|
||||
fputs (format->results_end, stdout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -415,8 +425,6 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
|
|||
|
||||
notmuch_query_set_sort (query, sort);
|
||||
|
||||
fputs (format->results_start, stdout);
|
||||
|
||||
switch (output) {
|
||||
default:
|
||||
case OUTPUT_SUMMARY:
|
||||
|
@ -432,8 +440,6 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
fputs (format->results_end, stdout);
|
||||
|
||||
notmuch_query_destroy (query);
|
||||
notmuch_database_close (notmuch);
|
||||
|
||||
|
|
Loading…
Reference in a new issue