Allow passing command-line arguments into run()
(#2173)
This commit is contained in:
parent
fcac7ee768
commit
e572b93d84
@ -1,5 +1,5 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
if let Err(code) = just::run() {
|
if let Err(code) = just::run(std::env::args_os()) {
|
||||||
std::process::exit(code);
|
std::process::exit(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use super::*;
|
|||||||
|
|
||||||
/// Main entry point into just binary.
|
/// Main entry point into just binary.
|
||||||
#[allow(clippy::missing_errors_doc)]
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn run() -> Result<(), i32> {
|
pub fn run(args: impl Iterator<Item = impl Into<OsString> + Clone>) -> Result<(), i32> {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
ansi_term::enable_ansi_support().ok();
|
ansi_term::enable_ansi_support().ok();
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ pub fn run() -> Result<(), i32> {
|
|||||||
let app = Config::app();
|
let app = Config::app();
|
||||||
|
|
||||||
info!("Parsing command line arguments…");
|
info!("Parsing command line arguments…");
|
||||||
let matches = app.get_matches();
|
let matches = app.get_matches_from(args);
|
||||||
|
|
||||||
let config = Config::from_matches(&matches).map_err(Error::from);
|
let config = Config::from_matches(&matches).map_err(Error::from);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user