Closed cstrahan closed 2 years ago
I wonder if that's because this line:
Should be more like:
$additionalCmd = @{ Preview=$("pwsh -NoProfile -NonInteractive -File \""$previewScript\"" -- \""" + $path + "\"" {}") }
(note the double hyphen; see https://stackoverflow.com/a/12198146)
As the cmdlet is passed directly to PsFzfTabExpansion-Preview.ps1, powershell try yo bind it as a parameters and then generate the error as the parameter is not declare (named parameter)
Get it working :
We can detect that completion is a ParameterName
if( $completionMatches[0].ResultType -eq 'ParameterName'){
$Command = $Line.Substring(0, $Line.indexof(' '))
$previewScript = $(Join-Path $PsScriptRoot 'helpers/PsFzfTabExpansion-Parameter.ps1')
$additionalCmd = @{ Preview=$("$PowerShellCMD -NoProfile -NonInteractive -File \""$previewScript\"" $Command {}") }
} else{
$previewScript = $(Join-Path $PsScriptRoot 'helpers/PsFzfTabExpansion-Preview.ps1')
$additionalCmd = @{ Preview=$("$PowerShellCMD -NoProfile -NonInteractive -File \""$previewScript\"" \""" + $path + "\"" {}") }
}
and invoke a script without named parameters
################################################################################
# Could not use named parameters #
################################################################################
$command = $args[0]
$parameter = $args[1]
$parameter = $parameter.replace('-','')
Get-Help -Name $Command -Parameter $parameter
Thanks for the suggestion @belotn ! I've used in my PR #121
When hitting tab after
Get-Module -
:Seems to fail here: https://github.com/kelleyma49/PSFzf/blob/0843f35b0e77101f0718e89bb075e20e4e211d23/helpers/PsFzfTabExpansion-Preview.ps1#L6
This is on the latest alpha of
PSFzF
:(also occurs with latest stable release)
FWIW, this is with the latest version of FZF installed through chocolatey:
Anything I can do to help resolve this? This module otherwise seems awesome!