diff options
| author | Teddy Wing | 2017-05-07 13:07:57 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-05-07 13:13:54 +0200 | 
| commit | e9f04e34f55c66890ad3d5351b36ad0cf914b7de (patch) | |
| tree | 8e06e36b20e4dbd8aeca3606bd6ab7e726786bd3 | |
| parent | ff613b36df684a78138541a72c49ff9d2c48c386 (diff) | |
| download | HearURL-e9f04e34f55c66890ad3d5351b36ad0cf914b7de.tar.bz2 | |
main.rs: Add browser option
This will be used to set the browser to open URLs in.
| -rw-r--r-- | src/main.rs | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/src/main.rs b/src/main.rs index 7e971a7..183079a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,6 +44,7 @@ fn main() {      let args: Vec<String> = env::args().collect();      let mut opts = Options::new(); +    opts.optopt("b", "browser", "set browser", "BROWSER");      opts.optflag("h", "help", "print this help menu");      let opt_matches = match opts.parse(&args[1..]) { @@ -56,6 +57,13 @@ fn main() {          return      } +    let browser = if opt_matches.opt_present("b") { +        opt_matches.opt_str("b") +    } else { +        print_usage(opts); +        return +    }; +      open_stream().unwrap_or_else(|e| {          writeln!(io::stderr(), "{}", e)              .expect("Failed printing to stderr"); | 
