mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
fixed bad error message if no arguments are provided
This commit is contained in:
parent
ea20d9960f
commit
77cd1358e6
@ -30,7 +30,6 @@ fn normal_main() {
|
|||||||
} else {
|
} else {
|
||||||
args
|
args
|
||||||
};
|
};
|
||||||
let path = std::env::args().nth(1).unwrap();
|
|
||||||
let mut file = match args.len() {
|
let mut file = match args.len() {
|
||||||
0 => {
|
0 => {
|
||||||
println!("Please provide some arguments, such as the path to a file or \"-e <code>\".");
|
println!("Please provide some arguments, such as the path to a file or \"-e <code>\".");
|
||||||
@ -113,14 +112,14 @@ fn normal_main() {
|
|||||||
s.push_str(v);
|
s.push_str(v);
|
||||||
s
|
s
|
||||||
}),
|
}),
|
||||||
path.into(),
|
std::path::PathBuf::new(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
println!("please provide either a file or -e and a script to run!");
|
println!("please provide either a file or -e and a script to run!");
|
||||||
std::process::exit(101);
|
std::process::exit(101);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsing::file::File::new(std::fs::read_to_string(&args[0]).unwrap(), path.into())
|
parsing::file::File::new(std::fs::read_to_string(&args[0]).unwrap(), args[0].as_str().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user