diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-09-02 23:19:54 +0300 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-09-02 23:19:54 +0300 |
| commit | da69dd6815d75e3bc046ac74f5dc04f2babb5bd3 (patch) | |
| tree | 7b4264cf19e50bf318b95ffb1541e6c87d456ffb /mu | |
| parent | fa65ac02fc6b7ef32d2a2cefeec89b237191087f (diff) | |
mu: refactor labels code
Split labels-cache and store-labels.
Diffstat (limited to 'mu')
| -rw-r--r-- | mu/mu-cmd-label.cc | 5 | ||||
| -rw-r--r-- | mu/mu-options.cc | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/mu/mu-cmd-label.cc b/mu/mu-cmd-label.cc index d2be417..72c9798 100644 --- a/mu/mu-cmd-label.cc +++ b/mu/mu-cmd-label.cc @@ -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()) diff --git a/mu/mu-options.cc b/mu/mu-options.cc index bacaf40..3d9f0da 100644 --- a/mu/mu-options.cc +++ b/mu/mu-options.cc @@ -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; |
