Skip to main content

preview_command

Function preview_command 

Source
pub fn preview_command(command: &str, max_len: usize) -> String
Expand description

Program-only label for callers that intentionally hide arguments.

User-visible Ran … surfaces use command_headline_with_args instead so the transcript identifies what was actually executed.

Multi-line commands preview their first non-empty line; long commands are head-truncated at a word boundary with a trailing ellipsis. The mid-string ellipsis of truncate_middle is avoided on purpose: cutting checkpoints/turn_1032 into tur…ool_calls reads as a rendering bug.

When the first line is only a script-runner prefix (python3 -c ", bare python3 -c, or an unclosed quote on a -c/-e/--code runner), the following lines are folded in so the header shows real script content (python3 -c "import json …) instead of a dangling python3 -c ".