Skip to content

Commit 4b8b265

Browse files
committed
add_fn_switches
1 parent 8590c82 commit 4b8b265

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ pub mod parse {
3131
pub fn switches() -> Vec<String> {
3232
let mut switches: Vec<String> = vec![];
3333
let args: Vec<String> = env::args().collect();
34-
for i in 0..args.len(){
35-
34+
let mut c_index: usize = 0;
35+
for i in &args {
36+
if i.starts_with("--"){
37+
if args[c_index].starts_with("--"){
38+
switches.push(i.to_owned());
39+
}
40+
}
41+
c_index = c_index+1;
3642
}
43+
return switches;
3744
}
3845
}

0 commit comments

Comments
 (0)