mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
## Why When `-c` or `--config` appears at multiple command levels, Clap retains only the deepest scope's values, dropping earlier overrides. ## What changed Collect config overrides from each command scope in order while preserving typed child arguments and their existing precedence. Arguments forwarded after `--` remain unchanged. ## Testing Add regression coverage for overrides split across nested `mcp add` commands, forwarded `-c` arguments, and validation of an invalid override before `app-server` when another override follows it. GitOrigin-RevId: 40c64eda866497e2f59491a523c6777a8bfe5d5f
38 lines
984 B
Rust
38 lines
984 B
Rust
//! Regression coverage for overrides split across CLI command boundaries.
|
|
|
|
use super::try_parse_from;
|
|
use crate::Subcommand;
|
|
use crate::mcp_cmd::McpSubcommand;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn preserves_scoped_overrides_and_forwarded_arguments() {
|
|
let cli = try_parse_from([
|
|
"codex",
|
|
"--config=a=1",
|
|
"mcp",
|
|
"-cb=2",
|
|
"add",
|
|
"example",
|
|
"-c",
|
|
"a=3",
|
|
"--",
|
|
"program",
|
|
"-c",
|
|
"payload",
|
|
])
|
|
.expect("parse");
|
|
assert_eq!(cli.config_overrides.raw_overrides, ["a=1", "b=2", "a=3"]);
|
|
let Some(Subcommand::Mcp(mcp)) = cli.subcommand else {
|
|
panic!("expected mcp");
|
|
};
|
|
assert_eq!(mcp.config_overrides.raw_overrides, ["a=3"]);
|
|
let McpSubcommand::Add(add) = mcp.subcommand else {
|
|
panic!("expected add");
|
|
};
|
|
assert_eq!(
|
|
add.transport_args.stdio.expect("stdio transport").command,
|
|
["program", "-c", "payload"],
|
|
);
|
|
}
|