mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 22:07:25 -08:00
parent
3e23bd30dd
commit
6db3c8cfc2
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
languageTemplate = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
|
languageTemplate = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
|
||||||
|
noVersion = "NO VERSION"
|
||||||
)
|
)
|
||||||
|
|
||||||
type loadContext func()
|
type loadContext func()
|
||||||
|
@ -162,6 +163,7 @@ func (l *language) setVersion() error {
|
||||||
var err error
|
var err error
|
||||||
if command.getVersion == nil {
|
if command.getVersion == nil {
|
||||||
if !l.env.HasCommand(command.executable) {
|
if !l.env.HasCommand(command.executable) {
|
||||||
|
lastError = errors.New(noVersion)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
versionStr, err = l.env.RunCommand(command.executable, command.args...)
|
versionStr, err = l.env.RunCommand(command.executable, command.args...)
|
||||||
|
|
|
@ -83,7 +83,7 @@ func TestLanguageFilesFoundButNoCommandAndVersionAndDisplayVersion(t *testing.T)
|
||||||
}
|
}
|
||||||
lang := bootStrapLanguageTest(args)
|
lang := bootStrapLanguageTest(args)
|
||||||
assert.True(t, lang.Enabled())
|
assert.True(t, lang.Enabled())
|
||||||
assert.Equal(t, "", lang.Error, "unicorn is not available")
|
assert.Equal(t, noVersion, lang.Error, "unicorn is not available")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLanguageFilesFoundButNoCommandAndVersionAndDontDisplayVersion(t *testing.T) {
|
func TestLanguageFilesFoundButNoCommandAndVersionAndDontDisplayVersion(t *testing.T) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ func TestRuby(t *testing.T) {
|
||||||
{Case: "Ruby files", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRubyFiles: true},
|
{Case: "Ruby files", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRubyFiles: true},
|
||||||
{Case: "Rakefile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRakeFile: true},
|
{Case: "Rakefile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRakeFile: true},
|
||||||
{Case: "Gemfile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasGemFile: true},
|
{Case: "Gemfile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasGemFile: true},
|
||||||
{Case: "Gemfile with version", ExpectedString: "", ExpectedEnabled: true, FetchVersion: true, HasGemFile: true},
|
{Case: "Gemfile with version", ExpectedString: noVersion, ExpectedEnabled: true, FetchVersion: true, HasGemFile: true},
|
||||||
{Case: "No files with version", ExpectedString: "", ExpectedEnabled: false, FetchVersion: true},
|
{Case: "No files with version", ExpectedString: "", ExpectedEnabled: false, FetchVersion: true},
|
||||||
{
|
{
|
||||||
Case: "Version with chruby",
|
Case: "Version with chruby",
|
||||||
|
|
Loading…
Reference in a new issue