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

Default Prompt Colors #520

Merged
merged 3 commits into from
Jan 10, 2018
Merged

Default Prompt Colors #520

merged 3 commits into from
Jan 10, 2018

Conversation

dahlbyk
Copy link
Owner

@dahlbyk dahlbyk commented Jan 10, 2018

Much easier to close #474 with the changes from #513.

  • DefaultPromptPrefix, DefaultPromptSuffix and DefaultPromptDebugSuffix are now PoshGitTextSpans that understand colors
  • DefaultPromptPathColor and DefaultPromptTimingColor are supported, too

Update: Also closes #469 by:

  • Exporting Get-PromptPath with our default ($GitPromptSettings-based) path behavior
  • Supporting DefaultPromptPath (also a PoshGitTextSpan) to control colors and the string to expand when prompt executes ('$(Get-PromptPath)' by default)

To customize how the path is displayed, the user would do something like...

function Get-FancyPromptPath {
  (Get-PromptPath).ToUpper()
}
$GitPromptSettings.DefaultPromptPath.Text = '$(Get-FancyPromptPath)'

rkeithhill
rkeithhill previously approved these changes Jan 10, 2018
Copy link
Collaborator

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

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

Nice adds. I like it!

And export Get-PromptPath to expose our default path logic
@dahlbyk
Copy link
Owner Author

dahlbyk commented Jan 10, 2018

I just pushed an additional commit to pivot from DefaultPromptPathColor to DefaultPromptPath to close #469. Updating this PR description to reflect the change.

image

@@ -282,6 +282,27 @@ function Get-PathStringComparison {
}
}

function Get-PromptPath {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's tempting to add parameters to this function Iike -AbbreviateHomeDir and -PathTruncateLimit which would eliminate the need for the equivalent $GitPromptSettings but the "discoverability" of this functionality would be very poor. Probably best to leave those in $GitPromptSettings.

Copy link
Owner Author

@dahlbyk dahlbyk Jan 10, 2018

Choose a reason for hiding this comment

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

That's exactly how I started, but moved away from it in favor of keeping the default DefaultPromptPath text simple ('$(Get-PromptPath)').

@dahlbyk dahlbyk merged commit 4265817 into develop Jan 10, 2018
@dahlbyk dahlbyk deleted the DefaultPrompt branch January 10, 2018 04:25
@dahlbyk dahlbyk mentioned this pull request Jan 10, 2018
@dahlbyk dahlbyk modified the milestone: v1.0 Apr 17, 2018
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