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

Export Write-VcsStatus to help module autoloading #283

Closed
wants to merge 1 commit into from

Conversation

Jackbennett
Copy link
Contributor

Hey, When we use your module in the profile on Cmder we try to import it as late as we can because it slows down the console startup.

We can just call Write-VcsStatus when within a git repo but you don't export that command so we can't leave powershell to auto import it. This fixed that.

By exporting `Write-VcsStatus` we can just check if we're in a git directory, only then call this function to style the prompt. Having powershell load the module into the session. Doing it at the start slows the startup for no reason if the user isn't in a git directory.

Seems you only have to mention the export in the .psd1 file for it to autoload.
@@ -25,6 +25,7 @@ PowerShellVersion = '2.0'
FunctionsToExport = @('Invoke-NullCoalescing',
'Write-GitStatus',
'Write-Prompt',
'Write-VcsStatus',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you flip tab to spaces for consistency? :trollface:

@Jackbennett
Copy link
Contributor Author

For future reference, could I have for pushed this? Wasn't sure since I'd already made the PR.

@theaquamarine
Copy link
Collaborator

Yes, force pushing or updating your branch should show up here.

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.

3 participants