-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Hey Justin,
First off, great work on this! I've made super heavy use of this module and it's been overall great. Something that I've noticed while using it though is that if the databases aren't open while I'm using the SecretManagement module in CommandLine - they ask to be opened even if I'm not looking at the specific database in question.
After digging into this - it looks like SecretManagement has an Autocompleter for both VaultNames and SecretNames. It looks like SecretManagement calls extension's Get-SecretInfo which calls Test-SecretVault which attempts to open up the Database if it's not already open. Now - I can see in most scenarios this isn't an issue because most people are only going to have 1 or 2 databases configured. In my situation though, I've got over 18 Vaults configured - and having to click "cancel" or type in 18 different passwords every time I accidentally trigger this Argument Completer kills me.
I went ahead and poked around and just simply adding a check for $MyInvocation.ScriptName seems to work - although there might be a better way to handle it. I threw it in Test-SecretVault.ps1 at Line 64:
elseif (-not [string]::IsNullOrWhiteSpace($MyInvocation.ScriptName)) { return $false }
Just wrote this up fairly quickly and didn't thoroughly test it - but I'll setup a dev environment and submit a pull request when I can if you'd like.