diff options
author | Jani Nikula <jani@nikula.org> | 2013-03-03 23:55:09 +0200 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2013-03-08 07:54:41 -0400 |
commit | 4ef2106792439f5ade157b3ba3b8f7fa86fcb3ed (patch) | |
tree | 892c4e1a8826b324eea1492d19b156b46ae95a06 /notmuch-client.h | |
parent | e76f6517de020783d828be59f461f1d4f465c4b4 (diff) |
cli: move config open/close to main() from subcommands
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.
Diffstat (limited to 'notmuch-client.h')
-rw-r--r-- | notmuch-client.h | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/notmuch-client.h b/notmuch-client.h index b3dcb21a..45749a6b 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -150,6 +150,8 @@ chomp_newline (char *str) */ extern int notmuch_format_version; +typedef struct _notmuch_config notmuch_config_t; + /* Commands that support structured output should support the * following argument * { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 } @@ -169,40 +171,34 @@ int notmuch_crypto_cleanup (notmuch_crypto_t *crypto); int -notmuch_count_command (void *ctx, int argc, char *argv[]); - -int -notmuch_dump_command (void *ctx, int argc, char *argv[]); +notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_new_command (void *ctx, int argc, char *argv[]); +notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_reply_command (void *ctx, int argc, char *argv[]); +notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_restore_command (void *ctx, int argc, char *argv[]); +notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_search_command (void *ctx, int argc, char *argv[]); +notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_setup_command (void *ctx, int argc, char *argv[]); +notmuch_search_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_show_command (void *ctx, int argc, char *argv[]); +notmuch_setup_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_tag_command (void *ctx, int argc, char *argv[]); +notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_search_tags_command (void *ctx, int argc, char *argv[]); +notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[]); int -notmuch_cat_command (void *ctx, int argc, char *argv[]); - -int -notmuch_config_command (void *ctx, int argc, char *argv[]); +notmuch_config_command (notmuch_config_t *config, int argc, char *argv[]); const char * notmuch_time_relative_date (const void *ctx, time_t then); @@ -243,8 +239,6 @@ json_quote_str (const void *ctx, const char *str); /* notmuch-config.c */ -typedef struct _notmuch_config notmuch_config_t; - notmuch_config_t * notmuch_config_open (void *ctx, const char *filename, |