Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tools/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ std::expected<ReadArgs, ToolError> check_read_args(ReadArgs a, const util::Bound
for (const char* k : {"paths", "files", "file_paths"})
if (auto it = a.raw.find(k); it != a.raw.end() && it->is_array() && it->size() > 1)
return std::unexpected(ToolError::invalid_args(std::format(
"read takes one `path`; got {} in `{}`. Make one read call per file "
"(they run in parallel).", it->size(), k)));
"read takes one `path`; got {} in `{}`. Make one read call per file.",
it->size(), k)));
// Name the keys that DID arrive: a typo in the key and an argument
// object that never arrived look the same otherwise.
return std::unexpected(ToolError::invalid_args(std::format(
Expand Down
8 changes: 4 additions & 4 deletions src/tools/util/shell_detour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,7 @@ Detour analyze_detour(std::string_view cmd) {
// The steps list names each call.
d.param.clear();
d.bound.reset();
d.reason = "each step is its own native call; make them in one "
"turn and they run in parallel, each with its own card.";
d.reason = "each step is its own native call.";
d.tool = "read";
d.intent = Intent::ReadFile;
} else if (v.param != d.param) {
Expand Down Expand Up @@ -804,8 +803,9 @@ std::string bash_tool_suggestion(const Detour& d) {
for (std::size_t i = 0; i < d.steps.size() && i < kShow; ++i)
tip += (i ? "; " : "") + ("`" + d.steps[i] + "`");
if (d.steps.size() > kShow) tip += "; \u2026";
tip += " \u2014 make them in one turn and they run in parallel, each "
"with its own card.";
// Which calls, not how to issue them: whether several calls in one
// turn run in parallel, and how they are shown, is the host's to say.
tip += ".";
return tip;
}
if (!d.param.empty()) {
Expand Down
4 changes: 4 additions & 0 deletions tests/bash_validate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ TEST_CASE("bash_validate") {
CHECK(t.find("2 native calls") != std::string::npos);
CHECK(t.find("`git_log count: 5, oneline: true`") != std::string::npos);
CHECK(t.find("`git_status`") != std::string::npos);
// Which calls only: the host decides how they run and are shown.
CHECK(t.ends_with("`git_status`."));
CHECK(t.find("parallel") == std::string::npos);
CHECK(t.find("card") == std::string::npos);
const auto m = tip("sed -n 1,5p a.cpp; grep -n x b.cpp");
CHECK(m.find("`read start_line: 1, end_line: 5`") != std::string::npos);
CHECK(m.find("`grep case_sensitive: true`") != std::string::npos);
Expand Down
Loading