summaryrefslogtreecommitdiff
path: root/mu/mu-cmd-labels.cc
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-12-14 09:42:27 +0200
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-12-15 23:54:40 +0200
commit10eddca5775e90653e89b1a9e81e213a36134c10 (patch)
tree03c137116f88afd27e7df3ccd1c75f9e35aad822 /mu/mu-cmd-labels.cc
parent1f06564b902b9ad53079c9962514659ca3ec04c2 (diff)
mu-labels: improve command-line handling
Esp., better handle the 'no subcommand' case: give the user some more useful help.
Diffstat (limited to 'mu/mu-cmd-labels.cc')
-rw-r--r--mu/mu-cmd-labels.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/mu/mu-cmd-labels.cc b/mu/mu-cmd-labels.cc
index 9f373e3..95c8c7e 100644
--- a/mu/mu-cmd-labels.cc
+++ b/mu/mu-cmd-labels.cc
@@ -168,7 +168,10 @@ label_import(Mu::Store& store, const Options& opts)
Result<void>
Mu::mu_cmd_labels(Mu::Store &store, const Options &opts)
{
- switch (opts.labels.sub) {
+ if (!opts.labels.sub)
+ return Ok(); // nothing to do.
+
+ switch (*opts.labels.sub) {
case Options::Labels::Sub::List:
return label_list(store, opts);
case Options::Labels::Sub::RestoreList:
@@ -181,7 +184,6 @@ Mu::mu_cmd_labels(Mu::Store &store, const Options &opts)
return label_export(store, opts);
case Options::Labels::Sub::Import:
return label_import(store, opts);
-
default:
return Err(Error{Error::Code::Internal,
"invalid sub-command"});
@@ -191,7 +193,7 @@ Mu::mu_cmd_labels(Mu::Store &store, const Options &opts)
#ifdef BUILD_TESTS
/*
- * Tests.
+ * Tests...
*
*/
#include <config.h>