Browse Source

Start moving over to cli.rs

Samuel W. Flint 3 years ago
parent
commit
0e0eb4c66e
2 changed files with 12 additions and 3 deletions
  1. 9 0
      src/cli.rs
  2. 3 3
      src/main.rs

+ 9 - 0
src/cli.rs

@@ -0,0 +1,9 @@
+#[macro_use]
+// extern crate clap;
+use clap::App;
+
+pub fn build_cli() -> App<'static, 'static> {
+    let yaml = load_yaml!("cli.yml");
+    let app = App::from_yaml(yaml).version(crate_version!());
+    app
+}

+ 3 - 3
src/main.rs

@@ -1,11 +1,12 @@
 #[macro_use]
 extern crate clap;
-use clap::App;
+// use clap::App;
 
 use std::env;
 use std::path::Path;
 
 mod lib;
+mod cli;
 
 use crate::lib::{
     config::{
@@ -22,8 +23,7 @@ use crate::lib::{
 };
 
 fn main() {
-    let yaml = load_yaml!("cli.yml");
-    let matches = App::from_yaml(yaml).version(crate_version!()).get_matches();
+    let matches = cli::build_cli().get_matches();
 
     let config_file = find_config_file(matches.value_of("config"));
     let mut configuration: Config = read_configuration_file(&config_file);