argi icon indicating copy to clipboard operation
argi copied to clipboard

Hyphenated arguments like `--long-opt` don't parse in macros

Open dan-da opened this issue 4 years ago • 1 comments

If I try to use an argument with a hypen in it, I get a compile error like:

error[E0609]: no field `args` on type `&argi::Argument<'_>`
  --> bin/main.rs:44:11
   |
44 |     match data!(bool, ctx => --include-methods) {
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field

Is this supported? Could it be? Perhaps by specifying the arg in quotes/string...

dan-da avatar Nov 10 '21 04:11 dan-da

It's a known issue in the beta unfortunately, for now the workaround is to do the quite ugly --include_methods. I'm getting back after a break so this is next on the list!

Current testing shows that this also occurs within the cli! macro. For example, --example-arg goes to --example --arg and -fwefwef will go to --fwefwef.

Owez avatar Nov 14 '21 10:11 Owez