Repository: google/argh (language: rust)

Issue:
Error for long names misses some validation constraints
I had this compiler error just now:

```
error: Long names must be lowercase
  --> ../../src/diagnostics/validator/logs/sink/src/main.rs:49:27
   |
49 |     #[argh(option, long = "ignore_tag")]
   |
```

The option name *is* lowercase, but it has an underscore that argh wasn't happy with. Replacing it with a dash made the macro happy. I think the error message should probably list the specific way that the identifier doesn't work.


Discussion / hints:

Fix patch:
diff --git a/argh_derive/src/parse_attrs.rs b/argh_derive/src/parse_attrs.rs
index 06febd5..a83ce5e 100644
--- a/argh_derive/src/parse_attrs.rs
+++ b/argh_derive/src/parse_attrs.rs
@@ -201,7 +201,7 @@ pub(crate) fn check_long_name(errors: &Errors, spanned: &impl syn::spanned::Span
         errors.err(spanned, "Long names must be ASCII");
     }
     if !value.chars().all(|c| c.is_lowercase() || c == '-' || c.is_ascii_digit()) {
-        errors.err(spanned, "Long names must be lowercase");
+        errors.err(spanned, "Long names may only contain lowercase letters, digits, and dashes");
     }
 }
 


Test patch:
diff --git a/argh/tests/ui/bad-long-names/bad-long-names.rs b/argh/tests/ui/bad-long-names/bad-long-names.rs
index 61a9696..6aaf8cf 100644
--- a/argh/tests/ui/bad-long-names/bad-long-names.rs
+++ b/argh/tests/ui/bad-long-names/bad-long-names.rs
@@ -5,9 +5,9 @@ struct Cmd {
     /// non-ascii
     привет: bool,
     #[argh(switch)]
-    /// uppercase
+    /// invalid character
     XMLHTTPRequest: bool,
-    #[argh(switch, long = "not really")]
+    #[argh(switch, long = "invalid_character")]
     /// bad attr
     ok: bool,
 }
diff --git a/argh/tests/ui/bad-long-names/bad-long-names.stderr b/argh/tests/ui/bad-long-names/bad-long-names.stderr
index 3396a5a..3e1f053 100644
--- a/argh/tests/ui/bad-long-names/bad-long-names.stderr
+++ b/argh/tests/ui/bad-long-names/bad-long-names.stderr
@@ -4,14 +4,14 @@ error: Long names must be ASCII
 6 |     привет: bool,
   |     ^^^^^^
 
-error: Long names must be lowercase
+error: Long names may only contain lowercase letters, digits, and dashes
  --> tests/ui/bad-long-names/bad-long-names.rs:9:5
   |
 9 |     XMLHTTPRequest: bool,
   |     ^^^^^^^^^^^^^^
 
-error: Long names must be lowercase
+error: Long names may only contain lowercase letters, digits, and dashes
   --> tests/ui/bad-long-names/bad-long-names.rs:10:27
    |
-10 |     #[argh(switch, long = "not really")]
-   |                           ^^^^^^^^^^^^
+10 |     #[argh(switch, long = "invalid_character")]
+   |                           ^^^^^^^^^^^^^^^^^^^