Browse code

Starting with the comand line options

Julio Biason authored on 21/02/2019 13:45:14
Showing 3 changed files

... ...
@@ -1 +1,4 @@
1 1
 *.sw?
2
+.idea
3
+
4
+**/target/**
... ...
@@ -3,5 +3,7 @@ name = "templater"
3 3
 version = "0.1.0"
4 4
 authors = ["Julio Biason <julio.biason@gmail.com>"]
5 5
 edition = "2018"
6
+description = "Generate files based on templates."
6 7
 
7 8
 [dependencies]
9
+clap = "2.32"
... ...
@@ -1,3 +1,27 @@
1
+use clap::App;
2
+use clap::Arg;
3
+use clap::crate_name;
4
+use clap::crate_version;
5
+use clap::crate_authors;
6
+use clap::crate_description;
7
+
1 8
 fn main() {
9
+    let params = App::new(crate_name!())
10
+        .version(crate_version!())
11
+        .author(crate_authors!())
12
+        .about(crate_description!())
13
+        .arg(Arg::with_name("bind")
14
+            .short("b")
15
+            .long("bind")
16
+            .value_name("ADDRESS")
17
+            .help("Binding address for the service")
18
+            .takes_value(true))
19
+        .arg(Arg::with_name("port")
20
+            .short("p")
21
+            .long("port")
22
+            .value_name("PORT")
23
+            .help("Port to bind")
24
+            .takes_value(true))
25
+        .get_matches();
2 26
     println!("Hello, world!");
3 27
 }