mirror of
https://github.com/openai/codex.git
synced 2026-05-15 08:42:34 +00:00
## Summary `codex app` should be a platform-aware entry point for opening Codex Desktop or helping users install it. Before this change, the command only existed on macOS and its default installer URL always pointed at the Apple Silicon DMG, which sent Intel Mac users to the wrong build. This updates the macOS path to choose the Apple Silicon or Intel DMG based on the detected processor, while keeping `--download-url` as an advanced override. It also enables `codex app` on Windows, where the CLI opens an installed Codex Desktop app when available and otherwise opens the Windows installer URL. --------- Co-authored-by: Felipe Coury <felipe.coury@openai.com>
26 lines
782 B
Rust
26 lines
782 B
Rust
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Debug, Parser)]
|
|
pub struct AppCommand {
|
|
/// Workspace path to open in Codex Desktop.
|
|
#[arg(value_name = "PATH", default_value = ".")]
|
|
pub path: PathBuf,
|
|
|
|
/// Override the app installer download URL (advanced).
|
|
#[arg(long = "download-url")]
|
|
pub download_url_override: Option<String>,
|
|
}
|
|
|
|
pub async fn run_app(cmd: AppCommand) -> anyhow::Result<()> {
|
|
let workspace = std::fs::canonicalize(&cmd.path).unwrap_or(cmd.path);
|
|
#[cfg(target_os = "macos")]
|
|
{
|
|
crate::desktop_app::run_app_open_or_install(workspace, cmd.download_url_override).await
|
|
}
|
|
#[cfg(target_os = "windows")]
|
|
{
|
|
crate::desktop_app::run_app_open_or_install(workspace, cmd.download_url_override).await
|
|
}
|
|
}
|