summaryrefslogtreecommitdiffstats
path: root/notmuch-count.c
AgeCommit message (Collapse)Author
2017-10-15cli: make notmuch count --exclude a boolean argumentJani Nikula
Commit 0f314c0c99be ("cli: convert notmuch_bool_t to stdbool") over-eagerly converted EXCLUDE_TRUE and EXCLUDE_FALSE to EXCLUDE_true and EXCLUDE_false in notmuch-count.c. We could just fix the case back, but convert the option to an actual boolean argument instead. We've used a keyword argument rather than a boolean argument for notmuch count --exclude for five years, since commit 785c1e497f05 ("cli: move count to the new --exclude=(true|false|flag) naming scheme."), "to allow future options to be added more easily". I think we can conclude future options aren't coming any time soon.
2017-10-09cli: convert notmuch_bool_t to stdboolJani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our own, except in the library interface for backward compatibility. Convert the cli and test binaries to stdbool.
2017-10-04cli: use designated initializers for opt descJani Nikula
Several changes at once, just to not have to change the same lines several times over: - Use designated initializers to initialize opt desc arrays. - Only initialize the needed fields. - Remove arg_id (short options) as unused. - Replace opt_type and output_var with several type safe output variables, where the output variable being non-NULL determines the type. Introduce checks to ensure only one is set. The downside is some waste of const space per argument; this could be saved by retaining opt_type and using a union, but that's still pretty verbose. - Fix some variables due to the type safety. Mostly a good thing, but leads to some enums being changed to ints. This is pedantically correct, but somewhat annoying. We could also cast, but that defeats the purpose a bit. - Terminate the opt desc arrays using {}. The output variable type safety and the ability to add new fields for just some output types or arguments are the big wins. For example, if we wanted to add a variable to set when the argument is present, we could do so for just the arguments that need it. Beauty is in the eye of the beholder, but I think this looks nice when defining the arguments, and reduces some of the verbosity we have there.
2017-08-30cppcheck: close files during shutdownDavid Bremner
Fix the following cppcheck errors: notmuch-count.c:207: error: Resource leak: input notmuch-tag.c:238: error: Resource leak: input We know that the program is shutting down here, but it does no harm to clean up a bit.
2017-06-25fix wrong printf formatting of signed/unsigned integersPiotr Trojanek
2017-03-22lib: make notmuch_query_add_tag_exclude return a status valueDavid Bremner
Since this is an ABI breaking change, but we already bumped the SONAME for the next release
2017-03-22lib: replace deprecated n_q_count_threads with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name.
2017-03-22lib: replace deprecated n_q_count_messages with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name. One or two remaining uses of the (removed) non-status returning version fixed at the same time
2017-03-22lib: replace deprecated n_q_search_messages with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name.
2016-06-05Use https instead of http where possibleDaniel Kahn Gillmor
Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
2015-10-05cli: update to use new count APIDavid Bremner
Essentially replace each call to notmuch_count_* with the corresponding _st call, followed by print_status_query.
2015-10-05cli/count: simplify and document return value of print_countDavid Bremner
Essentially a cosmetic change.
2015-09-20cli/count: update to use notmuch_query_search_messages_stDavid Bremner
This brings back status information that may have been hidden by the great library logging conversion. Note the change of the internal API / return-value for count_files. The other count calls to the lib will also get error handling when that API is updated in the lib.
2015-09-09cli/count: apply uncrustify changesDavid Bremner
Leave the indentation alone because I don't know how to duplicate it with Emacs.
2015-09-07cli/count: remove unused argument handling for output=modificationsDavid Bremner
In the end this UI was rejected, but bits of it stayed in the code to confuse future generations.
2015-08-14cli: add global option "--uuid"David Bremner
The function notmuch_exit_if_unmatched_db_uuid is split from notmuch_process_shared_options because it needs an open notmuch database. There are two exceptional cases in uuid handling. 1) notmuch config and notmuch setup don't currently open the database, so it doesn't make sense to check the UUID. 2) notmuch compact opens the database inside the library, so we either need to open the database just to check uuid, or change the API.
2015-08-14cli/count: add --lastmodDavid Bremner
In the short term we need a way to get lastmod information e.g. for the test suite. In the long term we probably want to add lastmod information to at least the structured output for several other clients (e.g. show, search).
2015-06-01cli: define shared options, use for --help and --versionDavid Bremner
Unfortunately it seems trickier to support --config globally The non-trivial changes are in notmuch.c; most of the other changes consists of blindly inserting two lines into every subcommand.
2014-01-18cli: clean up exit status code returned by the cli commandsJani Nikula
Apart from the status codes for format mismatches, the non-zero exit status codes have been arbitrary. Make the cli consistently return either EXIT_SUCCESS or EXIT_FAILURE.
2013-08-24cli: add --output=files option to notmuch countJani Nikula
Add support for querying the total number of files associated with the messages matching the search. This is mostly useful with an id:<message-id> query for a single message.
2013-04-01cli: add --batch option to notmuch countJani Nikula
Add support for reading queries from stdin, one per line, and writing results to stdout, one per line. This will bring considerable performance improvements when utilized in Emacs notmuch-hello, especially so when running remote notmuch.
2013-04-01cli: extract count printing to a separate function in notmuch countJani Nikula
Make count printing on a query string reusable. No functional changes.
2013-04-01cli: remove useless talloc_strdupJani Nikula
If the condition holds, query_string_from_args() has already returned a talloc allocated empty string. There's no need to duplicate that.
2013-03-08cli: move config open/close to main() from subcommandsJani Nikula
This allows specifying config file as a top level argument to notmuch, and generally makes it possible to override config file options in main(), without having to touch the subcommands. If the config file does not exist, one will be created for the notmuch main command and setup and help subcommands. Help is special in this regard; the config is created just to avoid errors about missing config, but it will not be saved. This also makes notmuch config the talloc context for subcommands.
2013-03-07cli: config: make notmuch_config_open() "is new" parameter input onlyJani Nikula
We now have a notmuch_config_is_new() function to query whether a config was created or not. Change the notmuch_config_open() is_new parameter into boolean create_new to determine whether the function should create a new config if one doesn't exist. This reduces the complexity of the API.
2012-05-05lib/cli: Make notmuch_database_open return a status codeAustin Clements
It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails.
2012-04-28Use notmuch_database_destroy instead of notmuch_database_closeJustus Winter
Adapt the notmuch binaries source to the notmuch_database_close split. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-07cli: move count to the new --exclude=(true|false|flag) naming scheme.Mark Walters
Move the option --no-exclude to the --exclude= scheme. Since there is no way to flag messages only true and false are implemented. Note that, for consistency with other commands, this is implemented as a keyword option rather than a boolean option.
2012-03-02cli: omit excluded messages in results where appropriate.Mark Walters
In all cases of notmuch count/search/show where the results returned cannot reflect the exclude flag return just the matched not-excluded results. If the caller wishes to have all the matched results (i.e., including the excluded ones) they should call with the --no-exclude option. The relevant cases are count: both threads and messages search: all cases except the summary view show: mbox format
2012-03-02cli: add --no-exclude option to count and search.Mark Walters
This option turns off the exclusion so all matching messages are returned. We do not need to add this to notmuch-show as that does not (yet) exclude.
2012-01-23search: rename auto_exclude_tags to {search, }exclude_tagsPieter Praet
All other config-related functions and args include the section title in their name, so for the sake of consistency, mirror that. Also, the "auto"matic part is a given, so that was dropped.
2012-01-16search: Support automatic tag exclusionsAustin Clements
This adds a "search" section to the config file and an "auto_tag_exclusions" setting in that section. The search and count commands pass tag tags from the configuration to the library.
2012-01-13count: Convert to new-style argument parsingAustin Clements
2011-11-15cli: add support for --output parameter in notmuch countJani Nikula
Add support for --output=messages (which remains the default) and --output=threads to notmuch count. Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15cli: drop unused code from notmuch countJani Nikula
Remove unused code within #if 0 blocks from notmuch count. Signed-off-by: Jani Nikula <jani@nikula.org>
2011-10-22cli: change argument parsing convention for subcommandsDavid Bremner
previously we deleted the subcommand name from argv before passing to the subcommand. In this version, the deletion is done in the actual subcommands. Although this causes some duplication of code, it allows us to be more flexible about how we parse command line arguments in the subcommand, including possibly using off-the-shelf routines like getopt_long that expect the name of the command in argv[0].
2010-04-09notmuch count: Remove special handling of "*".Carl Worth
From both the implementation and from the documentation. This is handled generically in the library for all search-based commands, so count doesn't need special treatment.
2010-04-09Have notmuch count default to showing the total.Mike Kelly
If no parameters are given to notmuch-count, or just '' or '*' are given, return the total number of messages in the database. update notmuch count help
2009-11-23Add 'notmuch count' command to show the count of matching messagesKeith Packard
Getting the count of matching threads or messages is a fairly expensive operation. Xapian provides a very efficient mechanism that returns an approximate value, so use that for this new command. This returns the number of matching messages, not threads, as that is cheap to compute. Signed-off-by: Keith Packard <keithp@keithp.com>