Skip to content

Commit

Permalink
cli: Accept package name as program name
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Feb 16, 2024
1 parent 8eee184 commit 8121787
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1948,13 +1948,17 @@ fn cd_member(cfg_override: &ConfigOverride, program_name: &str) -> Result<()> {
program.path.display()
));
}
let p_lib_name = Manifest::from_path(&cargo_toml)?.lib_name()?;
if program_name == p_lib_name {

let manifest = Manifest::from_path(&cargo_toml)?;
let pkg_name = manifest.package().name();
let lib_name = manifest.lib_name()?;
if program_name == pkg_name || program_name == lib_name {
std::env::set_current_dir(&program.path)?;
return Ok(());
}
}
}

Err(anyhow!("{} is not part of the workspace", program_name,))
}

Expand Down

0 comments on commit 8121787

Please sign in to comment.