Skip to content

Commit 37eb165

Browse files
committed
fixes, tests
1 parent 2deef38 commit 37eb165

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,15 @@ pub mod minparse {
5252
continue;
5353
}
5454
if i.starts_with("--"){
55-
if args[c_index].starts_with("--"){
55+
if !(args.len() <= c_index+1) {
56+
if args[c_index+1].starts_with("--") || c_index + 1 == args.len() {
57+
switches.push(i.to_owned());
58+
}
59+
}
60+
if args.len() == c_index +1 {
5661
switches.push(i.to_owned());
5762
}
63+
5864
}
5965
c_index = c_index+1;
6066
}

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use minparse::minparse;
2+
3+
fn main(){
4+
println!("\t\tprocname: {}
5+
switches: {:?}
6+
subcommands: {:?}", minparse::process_name(), minparse::switches(), minparse::subcommands())
7+
8+
}

0 commit comments

Comments
 (0)