KarlHeitmann / KarlHeitmann/rg_wrapper
Add a nested `rg` command
- Dominant language
- Rust
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
I want to create a new issue for this, because this user command I think it may be difficult. This can be an option to add on this feature #7 and is blocked by #3 .
Sometimes we want to grep something, for example let's grep all places where we use the `useState` hook on a React Project.
```
rg 'const.*useState`
```
This will probably give us hundreds of matches in a medium sized project. But let's imagine the user inputs a refined `rg` command that will narrow down that list of matches into 3 results:
```javascript
const [infoUsers, setInfoUsers] = useState([])
const [posts, setPosts] = useState([])
const [userPhotos, setUserPhotos] = useState([])
```
We can add a user action on #7 so rip grep can take each one of these matches, and ripgrep what has being matched with `.*`, and will show the results to the user for each case. With the results mentioned above, `rg_wrapper` will run this:
```
rg '[infoUsers, setInfoUsers] = '
rg '[posts, setPosts] = '
rg '[userPhotos, setUserPhotos] = '
```
We can refine the `rg commands` by asking the user if he wants to remove some patterns from the matches, so if the user adds ` [` at the beginning and `] = ` at the end, the commands to be run will become
```
rg 'infoUsers, setInfoUsers'
rg 'posts, setPosts'
rg 'userPhotos, setUserPhotos'
```
Furthermore, we can add a user option to split by commas so you can have `rg_wrapper` run this:
```
rg 'infoUsers`
rg 'setInfoUsers'
rg 'posts'
etc....
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading issues #3 and #7, since this proposal says it is blocked by #3 and extends #7. The issue names no files or tests; the work is done when users can refine matches and run the resulting nested rg commands interactively, including optional pattern removal and comma splitting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, rust
- Domain
- cli, search, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100