Add grep's context option to show lines before and after a match

This commit is contained in:
Nick Hammond
2024-05-24 08:59:33 -07:00
parent 10b8c826d8
commit 89994c8b20
12 changed files with 121 additions and 21 deletions

View File

@@ -125,6 +125,10 @@ class CommandsAccessoryTest < ActiveSupport::TestCase
assert_equal \
"docker logs app-mysql --since 5m --tail 100 --timestamps 2>&1 | grep 'thing'",
new_command(:mysql).logs(since: "5m", lines: 100, grep: "thing").join(" ")
assert_equal \
"docker logs app-mysql --since 5m --tail 100 --timestamps 2>&1 | grep 'thing' -C 2",
new_command(:mysql).logs(since: "5m", lines: 100, grep: "thing", context: 2).join(" ")
end
test "follow logs" do