1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! The Landon CLI
//!
//! ```ignore
//! # To install local version
//! cargo install -f --path . # In crate root
//!
//! # To install from crates.io
//! cargo install -f landon
//! ```

#![deny(missing_docs)]

use clap::load_yaml;
use clap::App;

mod blender;
use self::blender::process_blender_subcommand;

pub use self::blender::*;

/// Run the landon CLI
pub fn run() {
    let yaml = load_yaml!("cli.yml");

    let mut app = App::from_yaml(yaml);

    let mut help_text = vec![];
    app.write_long_help(&mut help_text).unwrap();
    let help_text: String = String::from_utf8(help_text).unwrap();

    let matches = app.get_matches();

    if let Some(matches) = matches.subcommand_matches("blender") {
        process_blender_subcommand(&matches);
    } else {
        println!("{}", help_text)
    }
}