🎯 Goal
Implement an eko search <pattern> command that performs a text search across all files in a given snapshot (or all snapshots) and reports matching file paths and line numbers, similar to grep -r but scoped to Eko snapshots.
💡 Expected Usage
# Search for a string in the latest snapshot
eko search "TODO"
# Search in a specific snapshot
eko search "TODO" --snapshot 8c9d1a2f
# Search across all snapshots
eko search "deprecated" --all
🛠️ Implementation Steps
- Create
cmd/search.go with Cobra command searchCmd.
- Walk
.eko/snapshots/<id>/ file tree and use bufio.Scanner to search each text file for the pattern (skip binaries using heuristics).
- Print matching file path, line number, and surrounding context (like
grep -n).
- Support
--all flag to iterate over all snapshot IDs from the DB.
- Add unit tests in
cmd/commands_test.go.
📖 See full details in GOOD_FIRST_ISSUES.md — Issue #16
🌟 Great for first-time contributors! Read CONTRIBUTING.md to get started.
🎯 Goal
Implement an
eko search <pattern>command that performs a text search across all files in a given snapshot (or all snapshots) and reports matching file paths and line numbers, similar togrep -rbut scoped to Eko snapshots.💡 Expected Usage
🛠️ Implementation Steps
cmd/search.gowith Cobra commandsearchCmd..eko/snapshots/<id>/file tree and usebufio.Scannerto search each text file for the pattern (skip binaries using heuristics).grep -n).--allflag to iterate over all snapshot IDs from the DB.cmd/commands_test.go.