I have a cli tool that operates effectively on InputArgs
, where
struct InputArgs(EnumA, EnumB);
enum EnumA { X, Y { foo: usize } };
struct WArgs { bar: usize };
enum EnumB { W(WArgs), Z };
I.e., there are multiple data-bearing enums, each variant of which needs different args/flags supplied.
What's a convenient/natural/standard way to represent this in cli flags? In particular, I've tried using rust's Clap library, but run into two issues
- ValueEnum doesn't work with data-bearing enum variants
- Subcommand does work with data-bearing enum variants (I think), but it doesn't work with multiple of them afaik - in my use case, neither enum is really a "subcommand", but just a nested component.
I guess I'd like to be able to call my program as ./myprogram -y --foo 3 -w --bar 4
or something similar.