Procházet zdrojové kódy

use structopt to parse arguments

Alexandre Janniaux před 5 roky
rodič
revize
dd8de4e54e
2 změnil soubory, kde provedl 19 přidání a 1 odebrání
  1. 1 0
      Cargo.toml
  2. 18 1
      src/main.rs

+ 1 - 0
Cargo.toml

@@ -7,3 +7,4 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
+structopt = "0.3"

+ 18 - 1
src/main.rs

@@ -1,3 +1,20 @@
+use std::path::PathBuf;
+use structopt::StructOpt;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "Localize", about = "Localize a static library into a single object archive")]
+struct LocalizeArgs
+{
+    /// list of file to merge
+    #[structopt(name = "FILE LIST", short = "i", long = "inputs")]
+    input_files: Vec<PathBuf>,
+
+    /// filename of the final library archive
+    #[structopt(name = "OUT FILE", short = "o", long = "output")]
+    output_file: PathBuf,
+}
+
 fn main() {
-    println!("Hello, world!");
+    let opt = LocalizeArgs::from_args();
+    println!("{:?}", opt);
 }