kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
752 stars 35 forks source link

[Feature Request] Allow customization for rg command in Invoke-PsFzfRipgrep #194

Open DanSM-5 opened 1 year ago

DanSM-5 commented 1 year ago

I found this function very useful however having the rg command fixed in the function is somewhat limiting. E.g. I cannot customize the excluded directories to add things like --glob "!node_modules" or allow search in hidden files --hidden.

The current implementation is like this:

$RG_PREFIX = "rg --column --line-number --no-heading --color=always --smart-case "

It could be refactored to allow a custom rg command to execute the Invoke-PsFzfRipgrep cmdlet.

$DEFAULT_RG_PREFIX = "rg --column --line-number --no-heading --color=always --smart-case"
$RG_PREFIX = if ($env:PSFZF_RG_PREFIX) { $env:PSFZF_RG_PREFIX } else { $DEFAULT_RG_PREFIX }

In the example above the custom variable would be $env:PSFZF_RG_PREFIX but the name is just an example.