diff --git a/lib/message/mu-labels.cc b/lib/message/mu-labels.cc index 3f800eba..13a789bc 100644 --- a/lib/message/mu-labels.cc +++ b/lib/message/mu-labels.cc @@ -20,12 +20,10 @@ #include "mu-labels.hh" #include -#include using namespace Mu; using namespace Mu::Labels; - Result Mu::Labels::validate_label(const std::string &label) { @@ -55,19 +53,24 @@ Mu::Labels::validate_label(const std::string &label) if (uc > ' ' && uc <= '~') { switch (uc) { case '"': + case ',': case '/': case '\\': case '*': case '$': return Err(Error{Error::Code::InvalidArgument, - "illegal character '{}' in label ({})", uc, label}); + "illegal character '{}' in label '{}'", uc, label}); default: break; } - } else + } else if (::isprint(uc)) return Err(Error{Error::Code::InvalidArgument, - "illegal non alpha-numeric character '{}' in label ({})", - uc, label}); + "illegal non alpha-numeric character '{}' in label '{}'", + static_cast(uc), label}); + else + return Err(Error{Error::Code::InvalidArgument, + "illegal non alpha-numeric character {:#x} in label '{}'", + uc, label}); } return Ok(); @@ -156,7 +159,6 @@ Mu::Labels::updated_labels(const LabelVec& labels, const DeltaLabelVec& deltas) static void test_parse_delta_label() { - { const auto expr = parse_delta_label("+foo"); assert_valid_result(expr); @@ -164,7 +166,6 @@ test_parse_delta_label() assert_equal(expr->second, "foo"); } - { const auto expr = parse_delta_label("-bar@cuux"); assert_valid_result(expr); diff --git a/man/meson.build b/man/meson.build index f48677b0..1034655c 100644 --- a/man/meson.build +++ b/man/meson.build @@ -55,6 +55,7 @@ man_orgs = [ 'mu-index.1.org', 'mu-info.1.org', 'mu-init.1.org', + 'mu-label.1.org', 'mu-mkdir.1.org', 'mu-move.1.org', 'mu-query.7.org', diff --git a/man/mu-label.1.org b/man/mu-label.1.org new file mode 100644 index 00000000..aab82b94 --- /dev/null +++ b/man/mu-label.1.org @@ -0,0 +1,156 @@ +#+TITLE: MU LABEL +#+MAN_CLASS_OPTIONS: :section-id "@SECTION_ID@" :date "@MAN_DATE@" +#+include: macros.inc + +* NAME + +mu-label - attach labels to messages. Export labels to file, and import them. + +* SYNOPSIS + +*mu* [​_COMMON-OPTIONS_​] *label* update [​UPDATE-OPTIONS​] "" --labels [{+,-}