kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
795 stars 36 forks source link

Invoke-Fzf working directory for -Preview #27

Closed antonburger-advanced closed 5 years ago

antonburger-advanced commented 5 years ago

When using Invoke-Fzf, the working directory of the fzf sub-process isn't changed to match the shell's current directory. When items are relative paths or otherwise depend on the current directory, this causes problems passing them to a preview command.

Using native fzf from a non-home location:

fzf --preview cd

the preview window outputs my current location.

But using Invoke-Fzf:

Invoke-Fzf -Preview cd

the preview window displays my home directory.

My actual use case was piping in a set of git branch names, and trying to preview the selected one with git log --graph {}, only to find that git was erroring on the lack of a .git subdirectory in the fzf process's working directory.

Using PSFzf 1.1.24 on Windows 8.1, PowerShell 6.2.2.

kelleyma49 commented 5 years ago

I've published a new release with a fix for this:

https://www.powershellgallery.com/packages/PSFzf/1.1.26