kelleyma49 / PSFzf

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

The Function 'Invoke-FuzzySetLocation' only lists Files #229

Closed Dominiquini closed 8 months ago

Dominiquini commented 10 months ago

When I call 'Invoke-FuzzySetLocation', the 'fzf' only list files, instead of directories, making it impossible to change the Location!

OS: Windows x64 Terminal: PowerShell 7.3.6 PSFzf: 2.5.16

Thanks.

Dominiquini commented 10 months ago

I found the problem:

I change this code:

    try {
        if ([string]::IsNullOrWhiteSpace($env:FZF_DEFAULT_COMMAND)) {
            Get-ChildItem $Directory -Recurse -ErrorAction Ignore | Where-Object { $_.PSIsContainer } | Invoke-Fzf | ForEach-Object { $result = $_ }
        }
        else {
            Invoke-Fzf | ForEach-Object { $result = $_ }
        }
    }
    catch {

    }

For this:

    try {
        Get-ChildItem $Directory -Recurse -ErrorAction Ignore | Where-Object { $_.PSIsContainer } | Invoke-Fzf | ForEach-Object { $result = $_ }
    }
    catch {

    }