mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
375184cf0e
commit
9457be3990
|
@ -27,6 +27,7 @@ Display the currently active .NET SDK version.
|
||||||
|
|
||||||
- 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`
|
||||||
- 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: the segment is always displayed
|
- `always`: the segment is always displayed
|
||||||
|
|
|
@ -26,6 +26,7 @@ Display the currently active golang version.
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
- 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`
|
||||||
- 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: the segment is always displayed
|
- `always`: the segment is always displayed
|
||||||
|
|
|
@ -26,6 +26,7 @@ Display the currently active julia version.
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
- 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`
|
||||||
- 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: the segment is always displayed
|
- `always`: the segment is always displayed
|
||||||
|
|
|
@ -26,6 +26,7 @@ Display the currently active node version.
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
- 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`
|
||||||
- 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: The segment is always displayed
|
- `always`: The segment is always displayed
|
||||||
|
|
|
@ -30,6 +30,7 @@ Supports conda, virtualenv and pyenv.
|
||||||
- display_default_env: `boolean` - show the name of the virtualenv when it's default (`system`, `base`)
|
- display_default_env: `boolean` - show the name of the virtualenv when it's default (`system`, `base`)
|
||||||
or not - defaults to `true`
|
or not - defaults to `true`
|
||||||
- display_version: `boolean` - display the python version - defaults to `true`
|
- display_version: `boolean` - display the python version - 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: the segment is always displayed
|
- `always`: the segment is always displayed
|
||||||
|
|
|
@ -26,6 +26,7 @@ Display the currently active ruby version.
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
- 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`
|
||||||
- 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
|
||||||
- display_mode: `string` - determines when the segment is displayed
|
- display_mode: `string` - determines when the segment is displayed
|
||||||
- `always`: the segment is always displayed
|
- `always`: the segment is always displayed
|
||||||
|
|
|
@ -98,9 +98,13 @@ func (l *language) string() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
err := l.setVersion()
|
err := l.setVersion()
|
||||||
if err != nil {
|
displayError := l.props.getBool(DisplayError, true)
|
||||||
|
if err != nil && displayError {
|
||||||
return err.Error()
|
return err.Error()
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if l.props.getBool(EnableHyperlink, false) {
|
if l.props.getBool(EnableHyperlink, false) {
|
||||||
return l.activeCommand.buildVersionURL(l.versionURLTemplate)
|
return l.activeCommand.buildVersionURL(l.versionURLTemplate)
|
||||||
|
|
|
@ -261,6 +261,24 @@ func TestLanguageEnabledMissingCommandCustomText(t *testing.T) {
|
||||||
assert.Equal(t, expected, lang.string(), "unicorn is available and uni and corn files are found")
|
assert.Equal(t, expected, lang.string(), "unicorn is available and uni and corn files are found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLanguageEnabledMissingCommandCustomTextHideError(t *testing.T) {
|
||||||
|
props := map[Property]interface{}{
|
||||||
|
MissingCommandText: "missing",
|
||||||
|
DisplayError: false,
|
||||||
|
}
|
||||||
|
args := &languageArgs{
|
||||||
|
commands: []*cmd{},
|
||||||
|
extensions: []string{uni, corn},
|
||||||
|
enabledExtensions: []string{uni, corn},
|
||||||
|
enabledCommands: []string{"unicorn"},
|
||||||
|
version: universion,
|
||||||
|
properties: props,
|
||||||
|
}
|
||||||
|
lang := bootStrapLanguageTest(args)
|
||||||
|
assert.True(t, lang.enabled())
|
||||||
|
assert.Equal(t, "", lang.string())
|
||||||
|
}
|
||||||
|
|
||||||
func TestLanguageEnabledCommandExitCode(t *testing.T) {
|
func TestLanguageEnabledCommandExitCode(t *testing.T) {
|
||||||
expected := 200
|
expected := 200
|
||||||
args := &languageArgs{
|
args := &languageArgs{
|
||||||
|
|
Loading…
Reference in a new issue