Repository navigation
fix(cli): support --cmd-file for batch commands (#1098) - #1150
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
This now conflicts with main after the module split in #1433 (the files moved into modules; see docs/ path map PR 1468). If you would rather not, I can open a PR that credits you, keeps your commits and shows a git range-diff against this one, so you'll still get credit and have visible work. |
|
Thanks for the heads-up, and I really appreciate the offer! I'd be happy to take you up on that. Please feel free to open a follow-up PR adapting the changes to the new module layout. It would be great to preserve the original commit authorship where possible and link back to #1150. Including the range-diff you mentioned would also make the relationship between the two PRs clear. Once the replacement PR is ready, I can close this one to avoid duplication. Thanks again for your help! |
Problem
deckcraft-cli runrequires each command in a separate--cmdargument. Large scripts exceed Windows' command-line length limit before the CLI can start, and JSON must also be quoted for the shell.Implementation
run --cmd-file FILE, retaining command sources in argument order alongside existing--cmdvalues.#comments, trim surrounding whitespace, and accept CRLF and an optional initial UTF-8 BOM.id[=JSON]parsing andSession::executepath into a small helper used by both sources. Bare command ids still receive an empty JSON object; inline command syntax, diagnostics and--printoutput are preserved.--save/--exportactions are not reached.The existing input/sample selection, output-format validation, save and export paths remain in place.
Regression coverage added
Five integration tests in the existing CLI test module cover:
=and#inside JSON strings, skipped blank/comments, whitespace, BOM, CRLF and a final line without a newline.--cmd-fileargument.The existing help regression also checks the new option and ordering/failure documentation. Fixtures are generated temporary text files and a small synthetic native deck; no external presentation assets are needed.
Static review and verification
Reviewed ownership/lifetimes, command ordering, shared parser behavior, error propagation before final output actions, the engine command contracts used by the tests, and help/source consistency.
git diff --checkcompleted without findings.No Rust compilation, Cargo tests, formatting checks, Clippy, xtask, WASM builds, or other platform builds were run locally. No dependencies were downloaded and no target directory was created. Regression tests have been added but not executed. Compilation and test results are pending upstream GitHub CI and maintainer review.
Before publication, #1098 was open and unassigned, its discussion contained no claim, and all 747 existing open/closed PRs were checked for equivalent work.
Limitations
--cmd -) is deferred;--cmd-filesupplies the requested file-based route around command-line length limits.--cmdfail-fast semantics, not a transaction: earlier explicit command side effects are not rolled back.Fixes #1098
Summary by CodeRabbit
runcommand now accepts UTF-8 command files with--cmd-file, alongside inline--cmdoptions. Commands from both sources run in the order provided.run --helpwith command-file usage and an example combining file and inline commands.