cli/display: label regex_files lines with Search

This commit is contained in:
2026-09-22 23:22:29 +08:00
parent de03e5932b
commit 7127190b9a
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -335,7 +335,7 @@ def _glob_detail(_args_json: str, result: str) -> str:
def _regex_prefix(args_json: str) -> str:
pattern = _json_str_arg(args_json, "pattern") or "?"
path = _json_str_arg(args_json, "path") or "."
return _pretty_prefix(f"* Grep '{pattern}' in '{path}' ")
return _pretty_prefix(f"* Search '{pattern}' in '{path}' ")
def _regex_detail(_args_json: str, result: str) -> str:
+4 -4
View File
@@ -350,17 +350,17 @@ async def test_pretty_glob_truncated(capsys: pytest.CaptureFixture[str]) -> None
assert "* Glob '*' in '.' (2 paths)" in out
async def test_pretty_grep(capsys: pytest.CaptureFixture[str]) -> None:
async def test_pretty_regex_files(capsys: pytest.CaptureFixture[str]) -> None:
result = "src/a.py:3: x = 1\nsrc/a.py:9: x = 2\nsrc/b.py:1: y = 3\n"
await render_events(_aiter([_pretty_call("regex_files", '{"pattern": "x"}'), _result(result)]))
out = capsys.readouterr().out
assert "* Grep 'x' in '.' (3 matches in 2 files)" in out
assert "* Search 'x' in '.' (3 matches in 2 files)" in out
async def test_pretty_grep_no_matches(capsys: pytest.CaptureFixture[str]) -> None:
async def test_pretty_regex_files_no_matches(capsys: pytest.CaptureFixture[str]) -> None:
await render_events(_aiter([_pretty_call("regex_files", '{"pattern": "zzz"}'), _result("(no matches)")]))
out = capsys.readouterr().out
assert "* Grep 'zzz' in '.' (no matches)" in out
assert "* Search 'zzz' in '.' (no matches)" in out
async def test_pretty_run_argv_success(capsys: pytest.CaptureFixture[str]) -> None: