Skip to content

Commit

Permalink
Allow passing command-line arguments into run() (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jun 19, 2024
1 parent fcac7ee commit e572b93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 2 additions & 2 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);

Expand Down

0 comments on commit e572b93

Please sign in to comment.