mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
1868e15137
commit
c4db62c644
|
@ -25,6 +25,7 @@ Display the currently active crystal version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the julia version - defaults to `true`
|
- display_version: `boolean` - display the julia version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active dart version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the dart version - defaults to `true`
|
- display_version: `boolean` - display the dart version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active .NET SDK version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the active version or not; useful if all you need is an icon indicating `dotnet`
|
- display_version: `boolean` - display the active version or not; useful if all you need is an icon indicating `dotnet`
|
||||||
is present - defaults to `true`
|
is present - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active golang version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the golang version - defaults to `true`
|
- display_version: `boolean` - display the golang version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active java version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the java version - defaults to `true`
|
- display_version: `boolean` - display the java version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the java command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the java command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active julia version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the julia version - defaults to `true`
|
- display_version: `boolean` - display the julia version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active node version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the node version - defaults to `true`
|
- display_version: `boolean` - display the node version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -26,6 +26,7 @@ Supports conda, virtualenv and pyenv.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_virtual_env: `boolean` - show the name of the virtualenv or not - defaults to `true`
|
- display_virtual_env: `boolean` - show the name of the virtualenv or not - defaults to `true`
|
||||||
- display_default: `boolean` - show the name of the virtualenv when it's default (`system`, `base`)
|
- display_default: `boolean` - show the name of the virtualenv when it's default (`system`, `base`)
|
||||||
or not - defaults to `true`
|
or not - defaults to `true`
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active ruby version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the ruby version - defaults to `true`
|
- display_version: `boolean` - display the ruby version - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -25,6 +25,7 @@ Display the currently active rust version.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
- home_enabled: `boolean` - display the segment in the HOME folder or not - defaults to `false`
|
||||||
- display_version: `boolean` - display the rust version (`rustc --version`) - defaults to `true`
|
- display_version: `boolean` - display the rust version (`rustc --version`) - defaults to `true`
|
||||||
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
- display_error: `boolean` - show the error context when failing to retrieve the version information - defaults to `true`
|
||||||
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
- missing_command_text: `string` - text to display when the command is missing - defaults to empty
|
||||||
|
|
|
@ -90,6 +90,8 @@ const (
|
||||||
VersionMismatchColor Property = "version_mismatch_color"
|
VersionMismatchColor Property = "version_mismatch_color"
|
||||||
// EnableVersionMismatch displays empty string by default
|
// EnableVersionMismatch displays empty string by default
|
||||||
EnableVersionMismatch Property = "enable_version_mismatch"
|
EnableVersionMismatch Property = "enable_version_mismatch"
|
||||||
|
// HomeEnabled displays the segment in the HOME folder or not
|
||||||
|
HomeEnabled Property = "home_enabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (l *language) string() string {
|
func (l *language) string() string {
|
||||||
|
@ -119,10 +121,11 @@ func (l *language) enabled() bool {
|
||||||
inHomeDir := func() bool {
|
inHomeDir := func() bool {
|
||||||
return l.env.getcwd() == l.env.homeDir()
|
return l.env.getcwd() == l.env.homeDir()
|
||||||
}
|
}
|
||||||
displayMode := l.props.getString(DisplayMode, DisplayModeFiles)
|
homeEnabled := l.props.getBool(HomeEnabled, false)
|
||||||
if inHomeDir() && displayMode != DisplayModeAlways {
|
if inHomeDir() && !homeEnabled {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
displayMode := l.props.getString(DisplayMode, DisplayModeFiles)
|
||||||
l.loadLanguageContext()
|
l.loadLanguageContext()
|
||||||
switch displayMode {
|
switch displayMode {
|
||||||
case DisplayModeAlways:
|
case DisplayModeAlways:
|
||||||
|
|
|
@ -441,15 +441,15 @@ func TestLanguageHyperlinkEnabledLessParamInTemplate(t *testing.T) {
|
||||||
func TestLanguageEnabledInHome(t *testing.T) {
|
func TestLanguageEnabledInHome(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Case string
|
Case string
|
||||||
DisplayMode string
|
HomeEnabled bool
|
||||||
ExpectedEnabled bool
|
ExpectedEnabled bool
|
||||||
}{
|
}{
|
||||||
{Case: "Always enabled", DisplayMode: DisplayModeAlways, ExpectedEnabled: true},
|
{Case: "Always enabled", HomeEnabled: true, ExpectedEnabled: true},
|
||||||
{Case: "Context disabled", DisplayMode: DisplayModeContext, ExpectedEnabled: false},
|
{Case: "Context disabled", HomeEnabled: false, ExpectedEnabled: false},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
props := map[Property]interface{}{
|
props := map[Property]interface{}{
|
||||||
DisplayMode: tc.DisplayMode,
|
HomeEnabled: tc.HomeEnabled,
|
||||||
}
|
}
|
||||||
args := &languageArgs{
|
args := &languageArgs{
|
||||||
commands: []*cmd{
|
commands: []*cmd{
|
||||||
|
|
Loading…
Reference in a new issue