Allow passing command-line arguments into run() (#2173)

This commit is contained in:
Casey Rodarmor 2024-06-19 16:25:36 -07:00 committed by GitHub
parent fcac7ee768
commit e572b93d84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
fn main() {
if let Err(code) = just::run() {
if let Err(code) = just::run(std::env::args_os()) {
std::process::exit(code);
}
}

View File

@ -2,7 +2,7 @@ use super::*;
/// Main entry point into just binary.
#[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)]
ansi_term::enable_ansi_support().ok();
@ -17,7 +17,7 @@ pub fn run() -> Result<(), i32> {
let app = Config::app();
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);