feat(v0.8.44): add codew convenience alias binary
Permanent short-form shim — forwards silently to codewhale. Six fewer keystrokes, no deprecation warning. Ships alongside codewhale and the legacy deepseek alias.
This commit is contained in:
@@ -10,6 +10,11 @@ description = "Agentic terminal facade for open-source and open-weight coding mo
|
||||
name = "codewhale"
|
||||
path = "src/main.rs"
|
||||
|
||||
# Short-form convenience alias — forwards to `codewhale` silently.
|
||||
[[bin]]
|
||||
name = "codew"
|
||||
path = "src/bin/codew_legacy_shim.rs"
|
||||
|
||||
# Legacy alias — forwards to `codewhale` and prints a deprecation notice.
|
||||
# Will be removed in v0.9.0.
|
||||
[[bin]]
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//! Convenience `codew` alias.
|
||||
//!
|
||||
//! Forwards argv to the `codewhale` dispatcher silently. This is a
|
||||
//! permanent short-form alias — six fewer keystrokes, same binary.
|
||||
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args_os()
|
||||
.skip(1)
|
||||
.map(|a| a.to_string_lossy().into_owned())
|
||||
.collect();
|
||||
|
||||
let status = match spawn_codewhale(&args) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"error: failed to spawn `codewhale`: {e}. Is it on PATH? \
|
||||
Install with `cargo install codewhale-cli` or via npm/Homebrew."
|
||||
);
|
||||
std::process::exit(127);
|
||||
}
|
||||
};
|
||||
std::process::exit(status.code().unwrap_or(1));
|
||||
}
|
||||
|
||||
fn spawn_codewhale(args: &[String]) -> std::io::Result<std::process::ExitStatus> {
|
||||
// Try PATH first.
|
||||
match Command::new("codewhale").args(args).status() {
|
||||
Ok(s) => return Ok(s),
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
|
||||
// On Windows, after an update the sibling `codewhale.exe` may be in the
|
||||
// same directory as this shim but not on PATH (#2006).
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if let Ok(exe_path) = env::current_exe() {
|
||||
if let Some(dir) = exe_path.parent() {
|
||||
let sibling = dir.join("codewhale.exe");
|
||||
if sibling.is_file() {
|
||||
return Command::new(sibling).args(args).status();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::NotFound,
|
||||
"codewhale not found on PATH or in sibling directory",
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user