Is there any way to ignore or skip a variant in an enum being used as a subcommand?
#[derive(StructOpt)]
struct Opt {
#[structopt(subcommand)]
subcommand: Subcommand,
}
#[derive(StructOpt)]
enum Subcommand {
One { arg: u8 },
Two ( arg: u8 },
// Don't make this available as a subcommand
#[structopt(skip)]
Three { arg: u8 },
}
I've got a large enum that is both used as subcommands for a CLI interface as well as the data for network calls by serializing as JSON using serde_json. This has worked great and cut down on the need to duplicate the majority of the data - something I had to deal with quite often in the past - but there are a couple of variants that I'd like to ignore/skip.
Is there any way to ignore or skip a variant in an enum being used as a subcommand?
I've got a large enum that is both used as subcommands for a CLI interface as well as the data for network calls by serializing as JSON using
serde_json
. This has worked great and cut down on the need to duplicate the majority of the data - something I had to deal with quite often in the past - but there are a couple of variants that I'd like to ignore/skip.