Fixed bug where flags would not be read
This commit is contained in:
parent
ce766427da
commit
3e7d921413
1 changed files with 10 additions and 3 deletions
|
@ -99,6 +99,10 @@ fn find_command() -> Option<String> {
|
|||
env::args().skip(1).filter(|x| !x.starts_with("-")).next()
|
||||
}
|
||||
|
||||
fn find_flag() -> Option<String> {
|
||||
env::args().skip(1).filter(|x| x.starts_with("-")).next()
|
||||
}
|
||||
|
||||
fn find_args(command: &str) -> Vec<String> {
|
||||
env::args()
|
||||
.skip(1)
|
||||
|
@ -113,9 +117,12 @@ fn main() {
|
|||
let _ = args.next();
|
||||
let first_arg = match find_command() {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
help(commands);
|
||||
exit(0);
|
||||
None => match find_flag() {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
help(commands);
|
||||
exit(0);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue