Skip to content

Commit 1b2d9d3

Browse files
committed
mu-find: insist on --linksdir for links
Fixes #2790.
1 parent ffb3563 commit 1b2d9d3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

man/mu-find.1.org

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,16 @@ Output results in the specified format.
127127
- The default is *plain*, i.e normal output with one line per message.
128128
- *links* outputs the results as a maildir with symbolic links to the found
129129
messages. This enables easy integration with mail-clients (see below for more
130-
information).
130+
information). This requires *--linksdir*.
131131
- *xml* formats the search results as XML.
132132
- *sexp* formats the search results as an s-expression as used in Lisp programming
133133
environments.
134134

135135
** --linksdir _dir_ and -c, --clearlinks
136-
When using *--format=links*, output the results as a maildir with symbolic links to
137-
the found messages. This enables easy integration with mail-clients (see below
138-
for more information). *mu* will create the maildir if it does not exist yet.
136+
When using *--format=links*, output the results as a maildir with symbolic links
137+
to the found messages. This enables easy integration with mail-clients (see
138+
below for more information). *mu* will create the maildir if it does not exist
139+
yet.
139140

140141
If you specify *--clearlinks*, existing symlinks will be cleared from the target
141142
directories; this allows for re-use of the same maildir. However, this option

mu/mu-cmd-find.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ get_query(const Store& store, const Options& opts)
164164
static Result<void>
165165
prepare_links(const Options& opts)
166166
{
167+
// XXX: can this be done as part of the option-parsing?
168+
if (opts.find.linksdir.empty())
169+
return Err(Error::Code::InvalidArgument, "--linksdir is required");
170+
167171
/* note, mu_maildir_mkdir simply ignores whatever part of the
168172
* mail dir already exists */
169173
if (auto&& res = maildir_mkdir(opts.find.linksdir, 0700, true); !res)

0 commit comments

Comments
 (0)