mirror of
https://github.com/openai/codex.git
synced 2026-04-29 17:06:51 +00:00
Add codex app macOS launcher (#10418)
- Add `codex app <path>` to launch the Codex Desktop app. - On macOS, auto-downloads the DMG if missing; non-macOS prints a link to chatgpt.com/codex.
This commit is contained in:
21
codex-rs/cli/src/app_cmd.rs
Normal file
21
codex-rs/cli/src/app_cmd.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
const DEFAULT_CODEX_DMG_URL: &str = "https://persistent.oaistatic.com/codex-app-prod/Codex.dmg";
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct AppCommand {
|
||||
/// Workspace path to open in Codex Desktop.
|
||||
#[arg(value_name = "PATH", default_value = ".")]
|
||||
pub path: PathBuf,
|
||||
|
||||
/// Override the macOS DMG download URL (advanced).
|
||||
#[arg(long, default_value = DEFAULT_CODEX_DMG_URL)]
|
||||
pub download_url: String,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub async fn run_app(cmd: AppCommand) -> anyhow::Result<()> {
|
||||
let workspace = std::fs::canonicalize(&cmd.path).unwrap_or(cmd.path);
|
||||
crate::desktop_app::run_app_open_or_install(workspace, cmd.download_url).await
|
||||
}
|
||||
Reference in New Issue
Block a user