2018-05-21 14:54:22 +00:00
|
|
|
#[macro_use]
|
2018-07-02 18:45:17 +00:00
|
|
|
extern crate clap;
|
2018-01-30 17:38:35 +00:00
|
|
|
|
2018-07-02 18:45:17 +00:00
|
|
|
use clap::Clap;
|
2018-01-30 17:38:35 +00:00
|
|
|
|
2018-07-02 18:45:17 +00:00
|
|
|
#[derive(Debug, Clap)]
|
2018-01-30 17:38:35 +00:00
|
|
|
pub struct Foo {
|
|
|
|
pub bar: Option<String>,
|
|
|
|
}
|
|
|
|
|
2018-07-02 18:45:17 +00:00
|
|
|
#[derive(Debug, Clap)]
|
2018-01-30 17:38:35 +00:00
|
|
|
pub enum Command {
|
2018-07-02 18:45:17 +00:00
|
|
|
#[clap(name = "foo")]
|
2018-05-21 14:54:22 +00:00
|
|
|
Foo(Foo),
|
2018-01-30 17:38:35 +00:00
|
|
|
}
|
|
|
|
|
2018-07-02 18:45:17 +00:00
|
|
|
#[derive(Debug, Clap)]
|
|
|
|
#[clap(name = "classify")]
|
2018-01-30 17:38:35 +00:00
|
|
|
pub struct ApplicationArguments {
|
2018-07-02 18:45:17 +00:00
|
|
|
#[clap(subcommand)]
|
2018-01-30 17:38:35 +00:00
|
|
|
pub command: Command,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2018-07-02 18:45:17 +00:00
|
|
|
let opt = ApplicationArguments::parse();
|
2018-01-30 17:38:35 +00:00
|
|
|
println!("{:?}", opt);
|
|
|
|
}
|