Browse Source

Add start of CLI

Samuel W. Flint 3 years ago
parent
commit
3613c0897a
2 changed files with 51 additions and 1 deletions
  1. 28 0
      src/cli.yml
  2. 23 1
      src/main.rs

+ 28 - 0
src/cli.yml

@@ -0,0 +1,28 @@
+name: sync-it
+version: "0.1.0"
+author: Samuel W. Flint <swflint@flintfam.org>
+about: Does awesome things
+settings:
+  - SubcommandRequired
+args:
+    - config:
+        short: c
+        long: config
+        value_name: FILE
+        help: Sets a custom config file
+        takes_value: true
+subcommands:
+  - run:
+      about: runs a group
+      args:
+        - name:
+            index: 1
+            multiple: true
+  # - test:
+  #       about: controls testing features
+  #       version: "1.3"
+  #       author: Someone E. <someone_else@other.com>
+  #       args:
+  #           - debug:
+  #               short: d
+  #               help: print debug information

+ 23 - 1
src/main.rs

@@ -1,3 +1,25 @@
+#[macro_use]
+extern crate clap;
+use clap::App;
+
+mod run;
+use run::run;
+
+mod config;
+
 fn main() {
-    println!("Hello, world!");
+    let yaml = load_yaml!("cli.yml");
+    let matches = App::from_yaml(yaml).get_matches();
+
+    match matches.subcommand_name() {
+        Some("run") => if let Some(matches) = matches.subcommand_matches("run") {
+            let names = matches.values_of("name").unwrap();
+            // names.mambo
+            // println!();
+            run(names);
+            // for thing in names {}
+        },
+        _ => println!("Nothing")
+    }
+    
 }