fix: empty-prompt error now returns non-null hint via newline-delimited usage string

claw '' and claw '   ' returned empty_prompt + hint:null because the
error message had no newline delimiter. Added usage hint. 61 CLI
contract tests pass.
This commit is contained in:
YeonGyu-Kim
2026-05-27 16:34:37 +09:00
parent bff370003b
commit efb1542a39
2 changed files with 35 additions and 1 deletions

View File

@@ -1378,8 +1378,9 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
// an empty prompt when credentials are present).
let joined = rest.join(" ");
if joined.trim().is_empty() {
// #798: add \n hint so split_error_hint extracts it (was empty_prompt + null)
return Err(
"empty prompt: provide a subcommand (run `claw --help`) or a non-empty prompt string"
"empty prompt: provide a subcommand or a non-empty prompt string.\nUsage: claw <subcommand> or claw -p <prompt>. Run `claw --help` for the full list."
.to_string(),
);
}