mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-11 02:24:49 +08:00
fix(cli): emit JSON for --resume with no command in --output-format json mode
claw --output-format json --resume <session> (no command) was printing:
'Restored session from <path> (N messages).'
to stdout as prose, regardless of output format.
Now emits:
{"kind":"restored","session_id":"...","path":"...","message_count":N}
159 CLI tests pass.
This commit is contained in:
@@ -2256,11 +2256,23 @@ fn resume_session(session_path: &Path, commands: &[String], output_format: CliOu
|
|||||||
};
|
};
|
||||||
|
|
||||||
if commands.is_empty() {
|
if commands.is_empty() {
|
||||||
println!(
|
if output_format == CliOutputFormat::Json {
|
||||||
"Restored session from {} ({} messages).",
|
println!(
|
||||||
resolved_path.display(),
|
"{}",
|
||||||
session.messages.len()
|
serde_json::json!({
|
||||||
);
|
"kind": "restored",
|
||||||
|
"session_id": session.session_id,
|
||||||
|
"path": resolved_path.display().to_string(),
|
||||||
|
"message_count": session.messages.len(),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"Restored session from {} ({} messages).",
|
||||||
|
resolved_path.display(),
|
||||||
|
session.messages.len()
|
||||||
|
);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user