Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions codex-rs/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,23 @@ mod tests {
assert_eq!(args.prompt.as_deref(), Some("re-review"));
}

#[test]
fn exec_help_does_not_advertise_a_second_positional() {
let mut cmd = MultitoolCli::command();
let exec = cmd
.find_subcommand_mut("exec")
.expect("exec subcommand should exist");

let mut help = Vec::new();
exec.write_long_help(&mut help)
.expect("exec help should render");
let help = String::from_utf8(help).expect("help should be utf-8");

assert!(help.contains("Usage: codex exec [OPTIONS] [PROMPT]"));
assert!(help.contains("codex exec [OPTIONS] <COMMAND> [ARGS]"));
assert!(!help.contains("[PROMPT] [COMMAND]"));
}

fn app_server_from_args(args: &[&str]) -> AppServerCommand {
let cli = MultitoolCli::try_parse_from(args).expect("parse");
let Subcommand::AppServer(app_server) = cli.subcommand.expect("app-server present") else {
Expand Down
5 changes: 4 additions & 1 deletion codex-rs/exec/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use codex_utils_cli::CliConfigOverrides;
use std::path::PathBuf;

#[derive(Parser, Debug)]
#[command(version)]
#[command(
version,
override_usage = "codex exec [OPTIONS] [PROMPT]\n codex exec [OPTIONS] <COMMAND> [ARGS]"
)]
pub struct Cli {
/// Action to perform. If omitted, runs a new non-interactive session.
#[command(subcommand)]
Expand Down