diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/icktool.yaml | 16 | ||||
-rw-r--r-- | src/main.rs | 29 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/icktool.yaml b/src/icktool.yaml new file mode 100644 index 0000000..db16e0b --- /dev/null +++ b/src/icktool.yaml @@ -0,0 +1,16 @@ +name: icktool +version: "0.0" +author: "Lars Wirzenius <liw@liw.fi>" +about: "Controls the ick CI system" +args: + - api: + help: choose ick controller to use + short: a + long: api + value_name: api + takes_value: true +subcommands: + - version: + about: show ick controller version + - status: + about: show ick status diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..ccae56f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,29 @@ +#[macro_use] +extern crate clap; +use clap::App; + +fn main() { + let yaml = load_yaml!("icktool.yaml"); + let matches = App::from_yaml(yaml).get_matches(); + + if let Some(api) = matches.value_of("api") { + println!("api: {}", api); + } + + if let Some(_) = matches.subcommand_matches("version") { + version(); + } else if let Some(_) = matches.subcommand_matches("status") { + status(); + } else { + eprintln!("no action taken!"); + std::process::exit(1); + } +} + +fn version() { + println!("status requested"); +} + +fn status() { + println!("status requested"); +} |