summaryrefslogtreecommitdiff
path: root/internal/io/fs/utils.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-20 13:51:06 +0300
committerPaul Buetow <paul@buetow.org>2025-06-20 13:51:06 +0300
commit4a8f1690c3e2e6aec34f22b516f0598c6a0da070 (patch)
tree82ecb4568df3e91c7958c2e9f491546e6f7e9701 /internal/io/fs/utils.go
parentb0a1e7928d5147d2a9fe0df710bf7c75a777e0d0 (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/utils.go')
-rw-r--r--internal/io/fs/utils.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/io/fs/utils.go b/internal/io/fs/utils.go
new file mode 100644
index 0000000..106b58a
--- /dev/null
+++ b/internal/io/fs/utils.go
@@ -0,0 +1,12 @@
+package fs
+
+import "os"
+
+// getHostname returns the system hostname
+func getHostname() string {
+ hostname, err := os.Hostname()
+ if err != nil {
+ return "unknown"
+ }
+ return hostname
+} \ No newline at end of file