balpan-rs / balpan

Simple CLI Tool that supports your onboarding for a journey on source code.
37 stars 7 forks source link

[Feature] support grep command #58

Closed notJoon closed 1 year ago

notJoon commented 1 year ago

Description

I implemented the grep command using the aho-corasick algorithm.

Initially, I was going to use the boyer-moore algorithm for single patterns and the AC algorithm only for multiple patterns, but due to various problems, I decided not to use the bm algorithm for now, but I plan to modify it later.

Anyway, the existing goals [TODO], [DONE], and other patterns are searchable, and the information of the searched patterns is stored in JSON using serde crate.

Command

grep -f <PATH> -p "p1 p2 ... pn" --format [plain|json]

--file, -f : file path (if `None`, scanning whole directory)
--pattern, -p: comment pattern (default `[TODO]` and `[DONE]`)
--format: Applying formatting (default: plain)

Related Issue

38

42

64

Tasks

malkoG commented 1 year ago

:+1: