diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-20 13:51:06 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-20 13:51:06 +0300 |
| commit | 4a8f1690c3e2e6aec34f22b516f0598c6a0da070 (patch) | |
| tree | 82ecb4568df3e91c7958c2e9f491546e6f7e9701 /internal/io/fs/grepprocessor_test.go | |
| parent | b0a1e7928d5147d2a9fe0df710bf7c75a777e0d0 (diff) | |
Fix dcat/dgrep serverless mode to show REMOTE protocol formatrefactor-trail-1
- Add serverless flag to CatProcessor and GrepProcessor
- Format output with REMOTE|hostname|transmittedPerc|count|sourceID|content in serverless mode
- Use actual system hostname instead of "serverless" placeholder
- Preserve plain mode behavior (no formatting when --plain is used)
- Fix grep processor to properly separate multiple matched lines
- Add shared getHostname utility function
- Update tests to include serverless parameter
This fixes the regression where dcat and dgrep in serverless mode were not
showing the dtail protocol format with transmission info and status details.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/io/fs/grepprocessor_test.go')
| -rw-r--r-- | internal/io/fs/grepprocessor_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/io/fs/grepprocessor_test.go b/internal/io/fs/grepprocessor_test.go index b558eab..376277c 100644 --- a/internal/io/fs/grepprocessor_test.go +++ b/internal/io/fs/grepprocessor_test.go @@ -12,7 +12,7 @@ func TestGrepProcessorBasic(t *testing.T) { testutil.AssertNoError(t, err) // Use plain mode to avoid color formatting issues in tests - gp := NewGrepProcessor(re, true, false, "testhost", 0, 0, 0) + gp := NewGrepProcessor(re, true, false, "testhost", false, 0, 0, 0) tests := []struct { name string @@ -46,7 +46,7 @@ func TestGrepProcessorWithContext(t *testing.T) { testutil.AssertNoError(t, err) // Test with before context = 2, after context = 1 - gp := NewGrepProcessor(re, true, false, "testhost", 2, 1, 0) + gp := NewGrepProcessor(re, true, false, "testhost", false, 2, 1, 0) lines := []string{ "line 1", @@ -83,7 +83,7 @@ func TestGrepProcessorMaxCount(t *testing.T) { testutil.AssertNoError(t, err) // Limit to 2 matches - gp := NewGrepProcessor(re, true, false, "testhost", 0, 0, 2) + gp := NewGrepProcessor(re, true, false, "testhost", false, 0, 0, 2) matchCount := 0 for i := 0; i < 5; i++ { @@ -106,7 +106,7 @@ func TestGrepProcessorPlainMode(t *testing.T) { re, err := regex.New("test", regex.Default) testutil.AssertNoError(t, err) - gp := NewGrepProcessor(re, true, false, "testhost", 0, 0, 0) + gp := NewGrepProcessor(re, true, false, "testhost", false, 0, 0, 0) // Test that plain mode preserves line endings tests := []struct { @@ -137,7 +137,7 @@ func TestGrepProcessorFormatLine(t *testing.T) { testutil.AssertNoError(t, err) // Test plain mode formatting to avoid color issues - gp := NewGrepProcessor(re, true, false, "testhost", 0, 0, 0) + gp := NewGrepProcessor(re, true, false, "testhost", false, 0, 0, 0) stats := &stats{} stats.updatePosition() |
