aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-05-07 13:07:57 +0200
committerTeddy Wing2017-05-07 13:13:54 +0200
commite9f04e34f55c66890ad3d5351b36ad0cf914b7de (patch)
tree8e06e36b20e4dbd8aeca3606bd6ab7e726786bd3
parentff613b36df684a78138541a72c49ff9d2c48c386 (diff)
downloadHearURL-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.rs8
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");