RamblingCookieMonster / RabbitMQTools

PowerShell module containing cmdlets to manage RabbitMQ.
http://ramblingcookiemonster.github.io/RabbitMQ-Intro/
MIT License
31 stars 22 forks source link

Module does not seem to play well with Solarized #41

Open pmcevoy opened 6 years ago

pmcevoy commented 6 years ago

I'm using the Solarized powershell prompt and have installed as per https://github.com/neilpa/cmd-colors-solarized

It seems that script (can't call it a module) sets up $global:options for it's own purposes and this breaks the usage in TabExpansion.ps1 on line 176 to the effect that when Import-Module RabbitMqTools I get a whole bunch of these errors:

Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\RabbitMQTools\1.5\ScriptsToProcess\TabExpansions.ps1:178 char:1
+ $global:options['CustomArgumentCompleters']['Test1:Name'] = $testComp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

I've tried to workaround by adding more conditional checks in the assignment, but I'm unfamiliar with the PSConsoleReadlineOptions class and purpose, and I can't add a property to it like a normal hashtable.

Pete

pmcevoy commented 6 years ago

In my above, it seems that Solarized assigns PSConsoleReadLineOptions to global:options. I've changed your TabExpansion.ps1 with a search/replace of global:options with global:rabbitOptions and I think that is working (I hate global variables but I think in this case it's only use so as to pass extra options t to the tabexpansion2 re-write on line 277