mu: refactor labels code
Split labels-cache and store-labels.
This commit is contained in:
@ -23,6 +23,8 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "mu-store.hh"
|
||||
#include "mu-store-labels.hh"
|
||||
|
||||
#include "message/mu-message.hh"
|
||||
#include "message/mu-labels.hh"
|
||||
|
||||
@ -118,8 +120,9 @@ label_list(Mu::Store& store, const Options& opts)
|
||||
if (opts.label.restore) {
|
||||
if (!opts.quiet)
|
||||
mu_println("labels: restoring list from store...");
|
||||
if (const auto res = store.restore_label_map(); !res)
|
||||
if (const auto res = store.restore_label_map(); !res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [label, n]: store.label_map())
|
||||
|
||||
@ -556,7 +556,7 @@ sub_label(CLI::App& sub, Options& opts)
|
||||
sub.final_callback([&](){
|
||||
if (sub.got_subcommand("list")) {
|
||||
opts.label.sub = Options::Label::Sub::List;
|
||||
opts.label.read_only = true;
|
||||
opts.label.read_only = opts.label.restore ? false : true;
|
||||
} else if (sub.got_subcommand("clear")) {
|
||||
opts.label.sub = Options::Label::Sub::Clear;
|
||||
opts.label.read_only = opts.label.dry_run;
|
||||
|
||||
Reference in New Issue
Block a user