Skip to content

Conversation

@stinos
Copy link
Contributor

@stinos stinos commented Apr 21, 2021

Main reason for this PR is (best of three for both cases, order doesn't matter):

> pwsh.exe -noprofile -c "&{Measure-Command{Import-Module ~\ZLocation\ZLocation\ZLocation.psm1 -ArgumentList @{AddFrequentFolders=$False; RegisterPromptHook=$False}}}"

TotalMilliseconds : 170.1995

> pwsh.exe -noprofile -c "&{Measure-Command{Import-Module ~\ZLocation\ZLocation\ZLocation.psm1}}"

TotalMilliseconds : 485.2165

but I think it's nice to have this configurable in general.

stinos added 3 commits April 21, 2021 10:14
Mention the directory needs to exist otherwise users are greeted with
rather meaningless 'The system cannot find the path specified.' errors.
Remove the instructions which hardcode the profile directory because
they are incorrect for PowerShell Core and teaching users to use
$PROFILE is better anyway.
Mention the default directory used for PowerShell Core as well to make
sure users know there are multiple locations.
Make the module consume arguments and use this to configure 2 things:
- prompt hook: currently prompt registration only works if no other
module also overrides the prompt function after importing the ZLocation
module. Normally fine, but it can be more convenient for users to just
define their own prompt and call Update-ZLocation in it
- adding frequent folders: this is nice, but it can also be particularly
slow (> 200mSec on an above-average machine) and is not always used
@mattcargile
Copy link

mattcargile commented Feb 21, 2022

This implementation doesn't account for the Register-PromptHook call in Set-ZLocation function. Once you z one time the prompt is altered.

Register-PromptHook

I'm not quite sure how I'd like to fix it.
I replaced the code with the below if block.

if ($ModuleArguments.RegisterPromptHook) {
    Register-PromptHook
}

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

Successfully merging this pull request may close these issues.

2 participants