mu-info: add 'maildirs' topic
For showing all maildirs under the root.
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
- *mu*: general mu build information (default)
|
- *mu*: general mu build information (default)
|
||||||
- *store*: information about the message store
|
- *store*: information about the message store
|
||||||
- *fields*: table with all the query fields and flags
|
- *fields*: table with all the query fields and flags
|
||||||
|
- *maildirs*: list all maildirs under the store's root-maildir
|
||||||
|
|
||||||
Note that while running (e.g. ~mu4e~), some of the ~store~ information can be
|
Note that while running (e.g. ~mu4e~), some of the ~store~ information can be
|
||||||
delayed due to database caching.
|
delayed due to database caching.
|
||||||
|
|||||||
@ -219,6 +219,15 @@ topic_store(const Mu::Store& store, const Options& opts)
|
|||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Result<void>
|
||||||
|
topic_maildirs(const Mu::Store& store, const Options& opts)
|
||||||
|
{
|
||||||
|
for (auto&& mdir: store.maildirs())
|
||||||
|
mu_println("{}", mdir);
|
||||||
|
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
static Result<void>
|
static Result<void>
|
||||||
topic_mu(const Options& opts)
|
topic_mu(const Options& opts)
|
||||||
{
|
{
|
||||||
@ -227,10 +236,8 @@ topic_mu(const Options& opts)
|
|||||||
using namespace tabulate;
|
using namespace tabulate;
|
||||||
|
|
||||||
info.add_row({"property", "value", "description"});
|
info.add_row({"property", "value", "description"});
|
||||||
info.add_row({"mu-version", std::string{VERSION},
|
info.add_row({"mu-version", std::string{VERSION}, "Mu runtime version"});
|
||||||
"Mu runtime version"});
|
info.add_row({"xapian-version", Xapian::version_string(), "Xapian runtime version"});
|
||||||
info.add_row({"xapian-version", Xapian::version_string(),
|
|
||||||
"Xapian runtime version"});
|
|
||||||
info.add_row({"gmime-version",
|
info.add_row({"gmime-version",
|
||||||
mu_format("{}.{}.{}", gmime_major_version, gmime_minor_version,
|
mu_format("{}.{}.{}", gmime_major_version, gmime_minor_version,
|
||||||
gmime_micro_version), "GMime runtime version"});
|
gmime_micro_version), "GMime runtime version"});
|
||||||
@ -281,6 +288,8 @@ Mu::mu_cmd_info(const Mu::Store& store, const Options& opts)
|
|||||||
const auto topic{opts.info.topic};
|
const auto topic{opts.info.topic};
|
||||||
if (topic == "store")
|
if (topic == "store")
|
||||||
return topic_store(store, opts);
|
return topic_store(store, opts);
|
||||||
|
else if (topic == "maildirs")
|
||||||
|
return topic_maildirs(store, opts);
|
||||||
else if (topic == "fields") {
|
else if (topic == "fields") {
|
||||||
topic_fields(opts);
|
topic_fields(opts);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
@ -298,8 +307,9 @@ Mu::mu_cmd_info(const Mu::Store& store, const Options& opts)
|
|||||||
col.fg(Color::Green), t, col.reset(), d);
|
col.fg(Color::Green), t, col.reset(), d);
|
||||||
};
|
};
|
||||||
|
|
||||||
mu_println("\nother info topics ('mu info <topic>'):\n{}\n{}",
|
mu_println("\nother info topics ('mu info <topic>'):\n{}\n{}\n{}",
|
||||||
topic("store", "information about the message store (database)"),
|
topic("store", "information about the message store (database)"),
|
||||||
|
topic("maildirs", "list the maildirs under the store's root-maildir"),
|
||||||
topic("fields", "information about message fields"));
|
topic("fields", "information about message fields"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user