Add progress cursor flag

This commit is contained in:
Dave Aitel
2026-02-06 13:27:15 -05:00
parent 94597f2663
commit 0d24339e75
2 changed files with 13 additions and 4 deletions

View File

@@ -82,6 +82,10 @@ pub struct Cli {
#[arg(long = "color", value_enum, default_value_t = Color::Auto)]
pub color: Color,
/// Force cursor-based progress updates in exec mode.
#[arg(long = "progress-cursor", default_value_t = false)]
pub progress_cursor: bool,
/// Print events to stdout as JSONL.
#[arg(
long = "json",

View File

@@ -112,6 +112,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
prompt,
output_schema: output_schema_path,
config_overrides,
progress_cursor,
} = cli;
let (_stdout_with_ansi, stderr_with_ansi) = match color {
@@ -122,10 +123,14 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
supports_color::on_cached(Stream::Stderr).is_some(),
),
};
let cursor_ansi = match color {
cli::Color::Never => false,
cli::Color::Always => true,
cli::Color::Auto => stderr_with_ansi || std::io::stderr().is_terminal(),
let cursor_ansi = if progress_cursor {
true
} else {
match color {
cli::Color::Never => false,
cli::Color::Always => true,
cli::Color::Auto => stderr_with_ansi || std::io::stderr().is_terminal(),
}
};
// Build fmt layer (existing logging) to compose with OTEL layer.