From 36b31eeb0a755bf667e9aebc33413d9ff8d40d45 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 9 Feb 2020 22:40:57 +0200 Subject: [PATCH] mu: check --maildir parameter for init Fixes #1568. --- mu/mu-cmd.c | 12 ++++++++++-- mu/mu-help-strings.txt | 26 ++++++++++++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/mu/mu-cmd.c b/mu/mu-cmd.c index 6727fb20..c00b6e7e 100644 --- a/mu/mu-cmd.c +++ b/mu/mu-cmd.c @@ -563,8 +563,16 @@ cmd_info (MuStore *store, MuConfig *opts, GError **err) static MuError cmd_init (MuConfig *opts, GError **err) { - MuStore *store; - const char *path; + MuStore *store; + const char *path; + + /* not provided, nor could we find a good default */ + if (!opts->maildir) { + mu_util_g_set_error (err, MU_ERROR_IN_PARAMETERS, + "missing --maildir parameter and could " + "not determine default"); + return MU_ERROR_IN_PARAMETERS; + } path = mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB); store = mu_store_new_create (path, diff --git a/mu/mu-help-strings.txt b/mu/mu-help-strings.txt index 99d43057..c314c38b 100644 --- a/mu/mu-help-strings.txt +++ b/mu/mu-help-strings.txt @@ -1,6 +1,6 @@ #-*-mode:org-*- # -# Copyright (C) 2012-2013 Dirk-Jan C. Binnema +# Copyright (C) 2012-2020 Dirk-Jan C. Binnema # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -111,15 +111,28 @@ directories and storing the results in a Xapian database.The data can then be queried using mu-find(1). #END +#BEGIN MU_CONFIG_CMD_INIT +#STRING +mu init [options] +#STRING +mu init is the mu command for setting up the mu database. +#END + +#BEGIN MU_CONFIG_CMD_INFO +#STRING +mu init [options] +#STRING +mu info is the command for getting information about a mu database. +#END + #BEGIN MU_CONFIG_CMD_MKDIR #STRING mu mkdir [options] [] #STRING -mu mkdir is the mu command for creating Maildirs.It does not +mu mkdir is the command for creating Maildirs.It does not use the mu database. #END - #BEGIN MU_CONFIG_CMD_REMOVE #STRING mu remove [options] [] @@ -127,19 +140,16 @@ mu remove [options] [] mu remove is the mu command to remove messages from the database. #END - #BEGIN MU_CONFIG_CMD_SERVER #STRING mu server [options] #STRING mu server starts a simple shell in which one can query and manipulate the mu database.The output of the commands is terms -of Lisp symbolic expressions (s-exps).mu server is not meant for -use by humans; instead, it is designed specificallyfor the -mu4e e-mail client. +of Lisp symbolic expressions (s-exps). Its main use is for +the mu4e e-mail client. #END - #BEGIN MU_CONFIG_CMD_SCRIPT #STRING mu script [] [-v]