Skip to content

Conversation

@driv
Copy link
Owner

@driv driv commented Sep 6, 2025

This commit introduces several major features and refactors the codebase for better flexibility and performance.

Features:

  • Multiple search patterns: Allows specifying multiple search patterns from the command line.
  • Multiple input files: The CLI now accepts multiple input files, separated by --.
  • Graceful shutdown: Uses context.Context to handle interruptions (like Ctrl+C) gracefully.
  • Improved CLI argument parsing: Migrated from kingpin to cobra to support more complex argument structures, like separating patterns from file paths with --.

Refactoring:

  • Decoupled processing: Introduced LineProcessor and FilesProcessor to separate concerns of line-level matching and file-level iteration.
  • Simplified file processing: The FilesProcessor is currently implemented with a single-threaded design for simplicity.
  • Efficient I/O: A BufferedFileOpener has been added to improve file reading performance.
  • Code organization: The logic from the deleted printer.go has been consolidated into the new lines_processor.go.

This commit introduces several major features and refactors the codebase for better flexibility and performance.

Features:
- Multiple search patterns: Allows specifying multiple search patterns from the command line.
- Multiple input files: The CLI now accepts multiple input files, separated by `--`.
- Graceful shutdown: Uses `context.Context` to handle interruptions (like Ctrl+C) gracefully.
- Improved CLI argument parsing: Migrated from `kingpin` to `cobra` to support more complex argument structures, like separating patterns from file paths with `--`.

Refactoring:
- Decoupled processing: Introduced `LineProcessor` and `FilesProcessor` to separate concerns of line-level matching and file-level iteration.
- Simplified file processing: The `FilesProcessor` is currently implemented with a single-threaded design for simplicity.
- Efficient I/O: A `BufferedFileOpener` has been added to improve file reading performance.
- Code organization: The logic from the deleted `printer.go` has been consolidated into the new `lines_processor.go`.
@driv driv merged commit 82de4ea into main Sep 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants