Skip to content

Commit 8ce7ef6

Browse files
committed
Expose a cargo function instead of CargoCommand::new, and rename CargoCommand as Command
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 24d196c commit 8ce7ef6

7 files changed

Lines changed: 111 additions & 79 deletions

File tree

src/cargo.rs renamed to src/cargo_cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait CargoCmd {
2525
fn checked_status(&mut self) -> Result<()>;
2626
}
2727

28-
pub fn cargo() -> Result<Command> {
28+
pub fn cargo_cmd() -> Result<Command> {
2929
let cargo = match env::var_os("CARGO") {
3030
Some(cargo) => Path::new(&cargo).canonicalize()?,
3131
None => which::which("cargo")?.canonicalize()?,

src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use anyhow::{Context, Result};
88
use clap::{Parser, Subcommand};
99
use const_format::formatcp;
1010

11-
use crate::cargo::{CargoCmd as _, cargo};
11+
use crate::cargo_cmd::{CargoCmd as _, cargo_cmd};
1212

1313
pub struct Args {
1414
pub manifest_path: Option<PathBuf>,
@@ -111,7 +111,7 @@ fn resolve_target_dir(
111111
env: &HashMap<OsString, OsString>,
112112
cwd: &PathBuf,
113113
) -> Result<PathBuf> {
114-
let output = cargo()?
114+
let output = cargo_cmd()?
115115
.env_clear()
116116
.envs(env.iter())
117117
.current_dir(cwd)
@@ -129,7 +129,7 @@ fn resolve_target_dir(
129129
}
130130

131131
fn resolve_target(env: &HashMap<OsString, OsString>, cwd: &PathBuf) -> Result<String> {
132-
let output = cargo()?
132+
let output = cargo_cmd()?
133133
.env_clear()
134134
.envs(env.iter())
135135
.current_dir(cwd)

0 commit comments

Comments
 (0)