sponte / sublime_powershell_help

Generates powershell help template for the the selected method name
Apache License 2.0
4 stars 1 forks source link

Throw exception on a simple use-case #2

Open vors opened 9 years ago

vors commented 9 years ago

I created file with content

function Download-File($url, $file) {
    $webclient = New-Object System.Net.WebClient
    $webclient.DownloadFile($url,$file)
}

Run Document cmdlet and get this error message

image

Message text:

---------------------------
Sublime Text
---------------------------
get-command : The term 'Download-File' 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:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:5 char:6
+ $c = get-command $commandName
+      ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Download-File:String) [Get-Comm 
   and], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
   mmands.GetCommandCommand

Cannot index into a null array.
At C:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:24 char:5
+     $parameter = $c.Parameters[$_]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:25 char:5
+     $parameters += $c.Parameters[$_]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

---------------------------
OK   
---------------------------