kelleyma49 / PSFzf

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

Populates the $Error variable #25

Closed farzadmf closed 5 years ago

farzadmf commented 5 years ago

Hi,

First of all, thank you for this useful module.

I just noticed something, which may or may not affect #23 (slow start), I noticed that whenever I start a PS session, my $Error variable is populated with all kinds of errors:

Get-Command : The term 'fgs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fgs:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'fz' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fz:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Variable : Cannot find a variable with the name 'IsWindows'.
At C:\Program Files\WindowsPowerShell\Modules\ZLocation\1.1.0\ZLocation.Search.psm1:3 char:5
+ if((Get-Variable IsWindows -ErrorAction SilentlyContinue) -eq $null)  ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (IsWindows:String) [Get-Variable], ItemNotFoundException
    + FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand

Get-Variable : Cannot find a variable with the name 'IsMacOS'.
At C:\Program Files\WindowsPowerShell\Modules\ZLocation\1.1.0\ZLocation.Service.psm1:61 char:25
+ ... :Mode = if( Get-Variable IsMacOS -ErrorAction SilentlyContinue ) { 'E ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (IsMacOS:String) [Get-Variable], ItemNotFoundException
    + FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand

Get-Command : The term 'cde' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (cde:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'fkill' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fkill:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'fh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fh:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'fasd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:83 char:11
+ } elseif (Get-Command fasd -ErrorAction SilentlyContinue) {
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fasd:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'Get-Frecents' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:68 char:5
+ if (Get-Command Get-Frecents -ErrorAction SilentlyContinue) {
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Frecents:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Command : The term 'fe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\1.1.23\PSFzf.Functions.ps1:11 char:15
+ ...   if (-not (Get-Command -Name $Name -ErrorAction SilentlyContinue)) { ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (fe:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

So, I thought it might be a good idea to use -ErrorAction Ignore to prevent this from happening

kelleyma49 commented 5 years ago

Fixed in https://www.powershellgallery.com/packages/PSFzf/1.1.24

farzadmf commented 5 years ago

Great, thanks :)