Okay here is an example of what I want to accomplish. I have a rigid, and complicated enum that must be parsed. The structure of the enum cant be changed.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, Subcommand)]
#[serde(rename_all = "snake_case")]
pub enum Msg {
SetConfig {
set_config_msg: AnotherEnum,
},
AddAsset {
asset_info_type: MyStruct,
},
AddNums {
num_1: u8,
num_2: u8
}
}
pub struct MyStruct {
string0: String,
string1: String
}
pub struct AnotherEnum {
Variant0,
Variant1(MyStruct),
}
for now you can imagine AnotherEnum and SomeStruct are any arbitrary enum and struct. What I would like is to interactively go through every single field here and get user input. It would look like this:
>>> my-cli set_config
Enter set_config_msg (Variant0 or Variant1)
>>> Variant1
Enter string0:
>>> Hello
Enter string1:
>>> World
Done
Any info is super helpful. Looking for some guidance. For context I am building a very general CLI that other people will have to use with totally different structs and enums. I'm hoping the macros in Clap will be enough to get me what I need. I can't change the structure of the Msg enum, but I can add derive macros etc.