Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable / Enable functionality #6

Open
briantist opened this issue Dec 30, 2017 · 1 comment
Open

Disable / Enable functionality #6

briantist opened this issue Dec 30, 2017 · 1 comment

Comments

@briantist
Copy link

briantist commented Dec 30, 2017

Is there a way to avoid turning this on automatically, or selectively enabling / disabling it?

I see the Start-HumpCompletion and Stop-HumpCompletion, but they seem to only set the value of $Global:HumpCompletionEnabled (a variable which is also set to $true by default at the end of loading the module), but I don't see that variable referenced elsewhere.

Because this must work by replacing TabExpansion2 I'm wondering if there's a way I can better control that this gets enabled, and a way to disable it explicitly.

This is of most concern because of module auto-loading, which can be triggered by many things, and because the ideal of way of installing this (Install-Module) is going to put it in an auto-loading capable place.

It's of course possible to Save-Module and put it somewhere locally, but this means breaking out of using the standard way of managing modules.

For me, ideally, this functionality is disabled by default, and you must explicitly call Start-HumpCompletion to replace TabExpansion2. This can then go into the appropriate $PROFILE based on who wants it to be loaded automatically in their session.

Advantages

  • Proper module management (the module can be kept global and allowed to use for anyone who wants to)
  • Can be loaded in profiles giving control over different environments, at different scopes (admin can enabled everywhere, individuals can enable / disable at will, etc.).
  • Can be avoided in scheduled tasks and other invocations regardless of profile by invoking powershell.exe -NoProfile
  • Helper functions for adding it to a profile can be included (a la posh-git's Add-PoshGitToProfile)

Looking forward to hearing your thoughts.

@stuartleeks
Copy link
Owner

stuartleeks commented Feb 4, 2018

@briantist - sorry for the delay in responding!

Last time I tested this, Install-Module wasn't sufficient to get the posh-HumpCompletion behaviour, I had to also add it to my $PROFILE. Are you seeing a different behaviour?

I'm currently testing an update to posh-HumpCompletion by spawning a new PowerShell session using powershell -NoProfile as you described and then explicitly loading the module from my dev folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants