diff options
| -rw-r--r-- | Cargo.lock | 8 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/main.rs | 13 |
3 files changed, 2 insertions, 20 deletions
@@ -1,12 +1,4 @@ [root] name = "alias-auto-add" version = "0.0.1" -dependencies = [ - "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "getopts" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3,4 +3,3 @@ name = "alias-auto-add" version = "0.0.1" [dependencies] -getopts = "0.2" diff --git a/src/main.rs b/src/main.rs index 6b9d79e..75e74ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,3 @@ -extern crate getopts; - -use getopts::Options; use std::env; use std::error::{self, Error}; use std::io::{self, BufRead, BufReader, Write}; @@ -168,15 +165,9 @@ fn print_usage(program: &str) { fn main() { let args: Vec<String> = env::args().collect(); let program = args[0].clone(); - let opts = Options::new(); - - let opt_matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!(f.to_string()), - }; - let file = if !opt_matches.free.is_empty() { - opt_matches.free[0].clone() + let file = if args.len() > 1 { + &args[1] } else { print_usage(&program); return; |
