Files
imeai-aKode/akode-rs/exec-server-cli/src/lib.rs

36 lines
1.2 KiB
Rust

//! Startup shared by the full Codex CLI and the standalone executor.
//! Internal sandbox and filesystem re-exec modes always dispatch before argument parsing.
use akode_utils_cli::CliConfigOverrides;
use akode_utils_cli::collect_config_overrides;
use clap::CommandFactory;
use clap::Parser;
mod command;
mod config;
mod exec_server_auth;
mod exec_server_credential;
mod exec_server_telemetry;
pub use command::ExecServerCommand;
#[derive(Debug, Parser)]
#[command(name = "akode-exec-server", bin_name = "akode-exec-server", version)]
struct ExecServerCli {
#[command(flatten)]
config_overrides: CliConfigOverrides,
#[command(flatten)]
command: ExecServerCommand,
}
/// Starts the executor after dispatching internal helper modes and preparing runtime paths.
pub fn run_standalone() -> anyhow::Result<()> {
akode_arg0::arg0_dispatch_or_else(|paths| async move {
let args: Vec<_> = std::env::args_os().collect();
let mut cli = ExecServerCli::parse_from(&args);
cli.config_overrides = collect_config_overrides(ExecServerCli::command(), args)
.unwrap_or_else(|error| error.exit());
cli.command.run(&paths, &cli.config_overrides).await
})
}