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

Feature: add some extra prompt-tuning hooks to profile.ps1 from user-profile.ps1 #950

Closed
centur opened this issue May 12, 2016 · 1 comment

Comments

@centur
Copy link

centur commented May 12, 2016

I'd like to suggest a feature for Cmder Powershell story:

profile.ps1 is doing prompt tuning by defining function global:prompt which is a normal powershell way of tuning prompts. Unfortunately there is no extension points added to a current fine-tuned prompt.

So if user wants to add extra customization or some hooks to their prompt via user-profile.ps1 (like persistent history and other neat tricks) - it's impossible as the only thing one can do is to override global:prompt and loose all cmder neat customization.

I'd like to provide few simple function hooks - which user can define in user-profile.ps1 but they will be executed in each prompt call.

I'm using this technique for awhile and found it pretty convenient, as well as nice performing -
Invoke-Expression doesn't add much overhead compared to the direct function call. I quickly smoke measured it with Measure-Command before PR and saw that it adds about
0.001 to 0.003 secs compared to direct invocation of the function which measured, with an empty function, to ~0.008)

So in overall this technique adds from 0.003 to 0.009 sec overhead (3 to 9 milliseconds) which is unnoticeable by a normal user.

@Jackbennett
Copy link
Contributor

Referenced on PR #952 to focus discussion into one place where the change may be made.

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