2017-11-01 07:41:58 +00:00
|
|
|
// Copyright (c) 2017 Guillaume Pinot <texitoi(a)texitoi.eu>
|
|
|
|
//
|
|
|
|
// This work is free. You can redistribute it and/or modify it under
|
|
|
|
// the terms of the Do What The Fuck You Want To Public License,
|
|
|
|
// Version 2, as published by Sam Hocevar. See the COPYING file for
|
|
|
|
// more details.
|
|
|
|
|
|
|
|
#[macro_use]
|
2018-01-29 22:51:40 +00:00
|
|
|
extern crate structopt;
|
2017-11-01 07:41:58 +00:00
|
|
|
|
|
|
|
use structopt::StructOpt;
|
|
|
|
use structopt::clap::AppSettings;
|
|
|
|
|
|
|
|
/// An example of raw attributes
|
|
|
|
#[derive(StructOpt, Debug)]
|
2018-02-04 14:27:26 +00:00
|
|
|
#[structopt(raw(global_settings = "&[AppSettings::ColoredHelp, AppSettings::VersionlessSubcommands]"))]
|
2017-11-01 07:41:58 +00:00
|
|
|
struct Opt {
|
|
|
|
/// Output file
|
|
|
|
#[structopt(short = "o", long = "output")]
|
|
|
|
output: String,
|
|
|
|
|
|
|
|
/// admin_level to consider
|
2018-02-04 14:27:26 +00:00
|
|
|
#[structopt(short = "l", long = "level", raw(aliases = "&[\"set-level\", \"lvl\"]"))]
|
2017-11-01 07:41:58 +00:00
|
|
|
level: Vec<String>,
|
|
|
|
|
|
|
|
/// Files to process
|
|
|
|
///
|
|
|
|
/// `level` is required if a file is called `FILE`.
|
2018-02-04 14:27:26 +00:00
|
|
|
#[structopt(name = "FILE", raw(requires_if = "\"FILE\", \"level\""))]
|
2017-11-01 07:41:58 +00:00
|
|
|
files: Vec<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let opt = Opt::from_args();
|
|
|
|
println!("{:?}", opt);
|
|
|
|
}
|