Closed Zaloog closed 1 year ago
Something I already tried:
https://github.com/kelleyma49/PSFzf/blob/f60a977702ccbea5540b856247137381c06359b7/PSFzf.Base.ps1#L747
Changing the joining character from ','
to ' '
But that somehow didnt work unfortunately. Anyone else has any insights?
That worked for me. Did you just change the file locally to test if it works? Because if yes, that can be a bit misleading, as there are different ways to define modules in Powershell and in the case of this lib if you added it through the usual Install-Module
way, the actual definitions are loaded from Modules/PSFzf/2.5.16/PSFzf.psm1
instead of each separate file.
(You can check if that's the case by doing an Import-Module PSFzf -Force -Verbose
).
I think that can probably be customized through an argument or config of some kind, I imagine the original rationale was that with ,
we would have "typed" an array of paths, which would arguably be the best option for invoking Powershell commands.
I have a pending issue that I was waiting for some feedback on the best way to solve a problem to possibly open a PR, and since it's been a while and it got no response (which is totally fine), I thought I would give it a go following my gut on the best way to tackle it.
When I do that I think I'm gonna take a crack at doing something for this delimiter too.
Also, if you don't want to make a local modification directly into an imported public module AND your use case allows for it, you could make a simple Powershell function that acts as a wrapper on the underlying binary you're trying to call passing the results as argument, and then just call the binary from that function but receiving the paths as an array and joining that with
(space) when calling the binary.
function Invoke-LsWithArray {
param (
[string[]] [Parameter(Position=0)] $paths,
[string[]] [Parameter(ValueFromRemainingArguments)] $restOfArgs
)
Start-Process ls -ArgumentList ($restOfArgs + ($paths -join ' '))
}
Set-Alias -Name ls -Value Invoke-LsWithArray
Or something like that. Of course YMMV according to your use case, maybe you work with a lot of different binaries or don't want or can't add a random handmade function like that.
Hi @mateusmedeiros,
after changing the mentioned section in the Modules/PSFzf/2.5.16/PSFzf.psm1
it worked like a charm :)
Thank you very much for your input.
I will close the issue with this comment
First of all thanks for your work on that. Just discovered it today and I really like the module.
I got a question, and was not able to find anything on google yet.
If I use
CTRL+t
and select mutliple results withTAB
and then pressENTER
, they are listed with "," as seperator. Is there an option to replace that with a normal space?so that instead of
file1,file2,file3
it would give mefile1 file2 file3
Kind Regards