Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) struct Env {
}

impl Env {
pub(crate) fn main() -> Result<Self> {
pub(crate) fn main(args: impl Iterator<Item = impl Into<OsString>>) -> Result<Self> {
let dir = env::current_dir().context(error::CurrentDirectoryGet)?;

let style = env::var_os("NO_COLOR").is_none()
Expand All @@ -20,7 +20,7 @@ impl Env {

Ok(Self::new(
dir,
env::args(),
args,
Box::new(io::stdin()),
out_stream,
err_stream,
Expand Down
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) = imdl::run() {
if let Err(code) = imdl::run(std::env::args()) {
std::process::exit(code);
}
}
10 changes: 8 additions & 2 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! `intermodal` is primarily used as a command-line binary, but does provide a
//! limited public library interface.
//!
//! Please keep in mind that there are no semantic version guarantees for the
//! library interface. It may break or change at any time.

use crate::common::*;

/// Entry point into the IMDL binary.
Expand All @@ -17,8 +23,8 @@ use crate::common::*;
/// In case of an error, a nonzero status code is returned. This status code can
/// be passed to `std::process::exit`, to exit the process and report its
/// failure to the system.
pub fn run() -> Result<(), i32> {
let mut env = match Env::main() {
pub fn run(args: impl Iterator<Item = impl Into<OsString>>) -> Result<(), i32> {
let mut env = match Env::main(args) {
Ok(env) => env,
Err(err) => {
eprintln!("{err}");
Expand Down
Loading