feat(language): cache version info

This commit is contained in:
Jan De Dobbeleer 2024-01-13 11:11:22 +01:00 committed by Jan De Dobbeleer
parent 0715bf1cec
commit ed40fc7bf5
50 changed files with 1018 additions and 968 deletions

View file

@ -282,3 +282,12 @@ func (env *MockedEnvironment) SystemInfo() (*platform.SystemInfo, error) {
args := env.Called() args := env.Called()
return args.Get(0).(*platform.SystemInfo), args.Error(1) return args.Get(0).(*platform.SystemInfo), args.Error(1)
} }
func (env *MockedEnvironment) Unset(name string) {
for i := 0; i < len(env.ExpectedCalls); i++ {
f := env.ExpectedCalls[i]
if f.Method == name {
f.Unset()
}
}
}

View file

@ -101,7 +101,7 @@ type Cache interface {
// In case the ttl expired, the function returns false. // In case the ttl expired, the function returns false.
Get(key string) (string, bool) Get(key string) (string, bool)
// Sets a value for a given key. // Sets a value for a given key.
// The ttl indicates how may minutes to cache the value. // The ttl indicates how many minutes to cache the value.
Set(key, value string, ttl int) Set(key, value string, ttl int)
// Deletes a key from the cache. // Deletes a key from the cache.
Delete(key string) Delete(key string)

View file

@ -2,108 +2,77 @@ package segments
import ( import (
"fmt" "fmt"
"path/filepath"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestCdsSegment(t *testing.T) { func TestCdsSegment(t *testing.T) {
cases := []struct { cases := []struct {
Case string Case string
ExpectedString string ExpectedString string
ExpectedEnabled bool Template string
File string Version string
Template string PackageJSON string
Version string DisplayMode string
PackageJSON string
DisplayMode string
}{ }{
{ {
Case: "1) cds 5.5.0 - file .cdsrc.json present", Case: "1) cds 5.5.0 - file .cdsrc.json present",
ExpectedString: "5.5.0", ExpectedString: "5.5.0",
ExpectedEnabled: true, Version: "@sap/cds: 5.5.0\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
File: ".cdsrc.json", DisplayMode: DisplayModeFiles,
Version: "@sap/cds: 5.5.0\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
DisplayMode: DisplayModeFiles,
}, },
{ {
Case: "2) cds 5.5.1 - file some.cds", Case: "2) cds 5.5.1 - file some.cds",
ExpectedString: "5.5.1", ExpectedString: "5.5.1",
ExpectedEnabled: true, Version: "@sap/cds: 5.5.1\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
File: "some.cds", DisplayMode: DisplayModeFiles,
Version: "@sap/cds: 5.5.1\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
DisplayMode: DisplayModeFiles,
}, },
{ {
Case: "3) cds 5.5.2 - no files", Case: "4) cds 5.5.3 - package.json dependency",
ExpectedString: "", ExpectedString: "5.5.3",
ExpectedEnabled: false, Version: "@sap/cds: 5.5.3\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
DisplayMode: DisplayModeFiles, PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
DisplayMode: DisplayModeContext,
}, },
{ {
Case: "4) cds 5.5.3 - package.json dependency", Case: "4) cds 5.5.4 - package.json dependency, major + minor",
ExpectedString: "5.5.3", ExpectedString: "5.5",
ExpectedEnabled: true, Template: "{{ .Major }}.{{ .Minor }}",
Version: "@sap/cds: 5.5.3\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3", Version: "@sap/cds: 5.5.4\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }", PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
DisplayMode: DisplayModeContext, DisplayMode: DisplayModeContext,
}, },
{ {
Case: "4) cds 5.5.4 - package.json dependency, major + minor", Case: "6) cds 5.5.9 - display always",
ExpectedString: "5.5", ExpectedString: "5.5.9",
ExpectedEnabled: true, Version: "@sap/cds: 5.5.9\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
Template: "{{ .Major }}.{{ .Minor }}", PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
Version: "@sap/cds: 5.5.4\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3", DisplayMode: DisplayModeAlways,
PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
DisplayMode: DisplayModeContext,
}, },
{ {
Case: "5) cds 5.5.5 - package.json present, no dependency, no files", Case: "8) cds 5.5.0 - file .cdsrc-private.json present",
ExpectedString: "", ExpectedString: "5.5.0",
ExpectedEnabled: false, Version: "@sap/cds: 5.5.0\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
Version: "@sap/cds: 5.5.5\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3", DisplayMode: DisplayModeFiles,
PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/some\": \"^5\" } }",
DisplayMode: DisplayModeContext,
},
{
Case: "6) cds 5.5.9 - display always",
ExpectedString: "5.5.9",
ExpectedEnabled: true,
Version: "@sap/cds: 5.5.9\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
DisplayMode: DisplayModeAlways,
},
{
Case: "7) cds 5.5.9 - package.json, no dependencies section",
ExpectedString: "",
ExpectedEnabled: false,
Version: "@sap/cds: 5.5.9\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
PackageJSON: "{ \"name\": \"my-app\" }",
DisplayMode: DisplayModeContext,
},
{
Case: "8) cds 5.5.0 - file .cdsrc-private.json present",
ExpectedString: "5.5.0",
ExpectedEnabled: true,
File: ".cdsrc-private.json",
Version: "@sap/cds: 5.5.0\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
DisplayMode: DisplayModeFiles,
}, },
} }
for _, tc := range cases { for _, tc := range cases {
var env = new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "cds").Return(true) cmd: "cds",
env.On("RunCommand", "cds", []string{"--version"}).Return(tc.Version, nil) versionParam: "--version",
env.On("Pwd").Return("/usr/home/dev/my-app") versionOutput: tc.Version,
env.On("Home").Return("/usr/home") extension: ".cdsrc.json",
}
env, props := getMockedLanguageEnv(params)
if tc.PackageJSON != "" { if len(tc.DisplayMode) == 0 {
tc.DisplayMode = DisplayModeContext
}
props[DisplayMode] = tc.DisplayMode
if len(tc.PackageJSON) != 0 {
env.On("HasFiles", "package.json").Return(true) env.On("HasFiles", "package.json").Return(true)
env.On("FileContent", "package.json").Return(tc.PackageJSON) env.On("FileContent", "package.json").Return(tc.PackageJSON)
} else { } else {
@ -111,37 +80,14 @@ func TestCdsSegment(t *testing.T) {
} }
cds := &Cds{} cds := &Cds{}
cds.Init(props, env)
props := properties.Map{
"display_mode": tc.DisplayMode,
}
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
if tc.Template == "" { if tc.Template == "" {
tc.Template = cds.Template() tc.Template = cds.Template()
} }
if tc.DisplayMode == "" {
tc.DisplayMode = DisplayModeContext
}
cds.Init(props, env)
for _, f := range cds.language.extensions {
match, err := filepath.Match(f, tc.File)
if err != nil {
t.Fail()
}
env.On("HasFiles", f).Return(match)
}
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case) failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
assert.Equal(t, tc.ExpectedEnabled, cds.Enabled(), failMsg) assert.True(t, cds.Enabled(), failMsg)
assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, cds), failMsg) assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, cds), failMsg)
} }
} }

View file

@ -2,102 +2,64 @@ package segments
import ( import (
"fmt" "fmt"
"path/filepath"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
func TestCFSegment(t *testing.T) { func TestCFSegment(t *testing.T) {
cases := []struct { cases := []struct {
Case string Case string
Template string Template string
ExpectedString string ExpectedString string
ExpectedEnabled bool CfYamlFile string
CfYamlFile string Version string
Version string DisplayMode string
DisplayMode string
}{ }{
{ {
Case: "1) cf 2.12.1 - file manifest.yml", Case: "1) cf 2.12.1 - file manifest.yml",
ExpectedString: "2.12.1", ExpectedString: "2.12.1",
ExpectedEnabled: true, CfYamlFile: "manifest.yml",
CfYamlFile: "manifest.yml", Version: `cf.exe version 2.12.1+645c3ce6a.2021-08-16`,
Version: `cf.exe version 2.12.1+645c3ce6a.2021-08-16`, DisplayMode: DisplayModeFiles,
DisplayMode: DisplayModeFiles,
}, },
{ {
Case: "2) cf 11.0.0-rc1 - file mta.yaml", Case: "2) cf 11.0.0-rc1 - file mta.yaml",
Template: "{{ .Major }}", Template: "{{ .Major }}",
ExpectedString: "11", ExpectedString: "11",
ExpectedEnabled: true, CfYamlFile: "mta.yaml",
CfYamlFile: "mta.yaml", Version: `cf version 11.0.0-rc1`,
Version: `cf version 11.0.0-rc1`, DisplayMode: DisplayModeFiles,
DisplayMode: DisplayModeFiles,
}, },
{ {
Case: "3) cf 11.0.0-rc1 - no file", Case: "4) cf 11.1.0-rc1 - mode always",
Template: "{{ .Major }}", Template: "{{ .Major }}.{{ .Minor }}",
ExpectedString: "", ExpectedString: "11.1",
ExpectedEnabled: false, Version: `cf.exe version 11.1.0-rc1`,
Version: `cf version 11.0.0-rc1`, DisplayMode: DisplayModeAlways,
DisplayMode: DisplayModeFiles,
},
{
Case: "4) cf 11.1.0-rc1 - mode always",
Template: "{{ .Major }}.{{ .Minor }}",
ExpectedString: "11.1",
ExpectedEnabled: true,
Version: `cf.exe version 11.1.0-rc1`,
DisplayMode: DisplayModeAlways,
}, },
} }
for _, tc := range cases { for _, tc := range cases {
var env = new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "cf").Return(true) cmd: "cf",
env.On("RunCommand", "cf", []string{"version"}).Return(tc.Version, nil) versionParam: "version",
env.On("Pwd").Return("/usr/home/dev/my-app") versionOutput: tc.Version,
env.On("Home").Return("/usr/home") extension: "manifest.yml",
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil) }
env, props := getMockedLanguageEnv(params)
env.On("TemplateCache").Return(&platform.TemplateCache{ props[DisplayMode] = tc.DisplayMode
Env: make(map[string]string),
})
cf := &Cf{} cf := &Cf{}
cf.Init(props, env)
props := properties.Map{
DisplayMode: tc.DisplayMode,
}
if tc.Template == "" { if tc.Template == "" {
tc.Template = cf.Template() tc.Template = cf.Template()
} }
cf.Init(props, env)
for _, f := range cf.language.extensions {
match, err := filepath.Match(f, tc.CfYamlFile)
if err != nil {
t.Fail()
}
if match {
env.On("HasFiles", f).Return(true)
} else {
env.On("HasFiles", f).Return(false)
}
}
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case) failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
assert.Equal(t, tc.ExpectedEnabled, cf.Enabled(), failMsg) assert.True(t, cf.Enabled(), failMsg)
assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, cf), failMsg) assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, cf), failMsg)
} }
} }

View file

@ -4,52 +4,40 @@ import (
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/constants" "github.com/jandedobbeleer/oh-my-posh/src/constants"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
func TestDotnetSegment(t *testing.T) { func TestDotnetSegment(t *testing.T) {
cases := []struct { cases := []struct {
Case string Case string
Expected string Expected string
ExitCode int ExitCode int
HasCommand bool Version string
Version string
FetchVersion bool
}{ }{
{Case: "Unsupported version", Expected: "\uf071", HasCommand: true, FetchVersion: true, ExitCode: constants.DotnetExitCode, Version: "3.1.402"}, {Case: "Unsupported version", Expected: "\uf071", ExitCode: constants.DotnetExitCode, Version: "3.1.402"},
{Case: "Regular version", Expected: "3.1.402", HasCommand: true, FetchVersion: true, Version: "3.1.402"}, {Case: "Regular version", Expected: "3.1.402", Version: "3.1.402"},
{Case: "Regular version", Expected: "", HasCommand: true, FetchVersion: false, Version: "3.1.402"},
{Case: "Regular version", Expected: "", HasCommand: false, FetchVersion: false, Version: "3.1.402"},
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "dotnet").Return(tc.HasCommand) cmd: "dotnet",
versionParam: "--version",
versionOutput: tc.Version,
extension: "*.cs",
}
env, props := getMockedLanguageEnv(params)
if tc.ExitCode != 0 { if tc.ExitCode != 0 {
env.Unset("RunCommand")
err := &platform.CommandError{ExitCode: tc.ExitCode} err := &platform.CommandError{ExitCode: tc.ExitCode}
env.On("RunCommand", "dotnet", []string{"--version"}).Return("", err) env.On("RunCommand", "dotnet", []string{"--version"}).Return("", err)
} else {
env.On("RunCommand", "dotnet", []string{"--version"}).Return(tc.Version, nil)
} }
env.On("HasFiles", "*.cs").Return(true)
env.On("PathSeparator").Return("")
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props := properties.Map{
properties.FetchVersion: tc.FetchVersion,
}
dotnet := &Dotnet{} dotnet := &Dotnet{}
dotnet.Init(props, env) dotnet.Init(props, env)
assert.True(t, dotnet.Enabled()) assert.True(t, dotnet.Enabled())
assert.Equal(t, tc.Expected, renderTemplate(env, dotnet.Template(), dotnet), tc.Case) assert.Equal(t, tc.Expected, renderTemplate(env, dotnet.Template(), dotnet), tc.Case)
} }

View file

@ -6,38 +6,11 @@ import (
"os" "os"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
type mockedLanguageParams struct {
cmd string
versionParam string
versionOutput string
extension string
}
func getMockedLanguageEnv(params *mockedLanguageParams) (*mock.MockedEnvironment, properties.Map) {
env := new(mock.MockedEnvironment)
env.On("HasCommand", params.cmd).Return(true)
env.On("RunCommand", params.cmd, []string{params.versionParam}).Return(params.versionOutput, nil)
env.On("HasFiles", params.extension).Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
props := properties.Map{
properties.FetchVersion: true,
}
return env, props
}
func TestGolang(t *testing.T) { func TestGolang(t *testing.T) {
cases := []struct { cases := []struct {
Case string Case string

View file

@ -5,12 +5,9 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
func TestHaskell(t *testing.T) { func TestHaskell(t *testing.T) {
@ -57,36 +54,32 @@ func TestHaskell(t *testing.T) {
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
cmd: "ghc",
versionParam: "--numeric-version",
versionOutput: tc.GhcVersion,
extension: "*.hs",
}
env, props := getMockedLanguageEnv(params)
if tc.StackGhcMode == "always" || (tc.StackGhcMode == "package" && tc.InStackPackage) { if tc.StackGhcMode == "always" || (tc.StackGhcMode == "package" && tc.InStackPackage) {
env.On("HasCommand", "stack").Return(true) env.On("HasCommand", "stack").Return(true)
env.On("RunCommand", "stack", []string{"ghc", "--", "--numeric-version"}).Return(tc.StackGhcVersion, nil) env.On("RunCommand", "stack", []string{"ghc", "--", "--numeric-version"}).Return(tc.StackGhcVersion, nil)
} else {
env.On("HasCommand", "ghc").Return(true)
env.On("RunCommand", "ghc", []string{"--numeric-version"}).Return(tc.GhcVersion, nil)
} }
fileInfo := &platform.FileInfo{ fileInfo := &platform.FileInfo{
Path: "../stack.yaml", Path: "../stack.yaml",
ParentFolder: "./", ParentFolder: "./",
IsDir: false, IsDir: false,
} }
if tc.InStackPackage { if tc.InStackPackage {
var err error var err error
env.On("HasParentFilePath", "stack.yaml").Return(fileInfo, err) env.On("HasParentFilePath", "stack.yaml").Return(fileInfo, err)
} else { } else {
env.On("HasParentFilePath", "stack.yaml").Return(fileInfo, errors.New("no match")) env.On("HasParentFilePath", "stack.yaml").Return(fileInfo, errors.New("no match"))
} }
env.On("HasFiles", "*.hs").Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props := properties.Map{
properties.FetchVersion: true,
}
props[StackGhcMode] = tc.StackGhcMode props[StackGhcMode] = tc.StackGhcMode
h := &Haskell{} h := &Haskell{}

View file

@ -4,9 +4,6 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -56,12 +53,14 @@ func TestJava(t *testing.T) {
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "java").Return(true) cmd: "java",
env.On("RunCommand", "java", []string{"-Xinternalversion"}).Return(tc.Version, nil) versionParam: "-Xinternalversion",
env.On("HasFiles", "pom.xml").Return(true) versionOutput: tc.Version,
env.On("Pwd").Return("/usr/home/project") extension: "pom.xml",
env.On("Home").Return("/usr/home") }
env, props := getMockedLanguageEnv(params)
if tc.JavaHomeEnabled { if tc.JavaHomeEnabled {
env.On("Getenv", "JAVA_HOME").Return("/usr/java") env.On("Getenv", "JAVA_HOME").Return("/usr/java")
env.On("HasCommand", "/usr/java/bin/java").Return(true) env.On("HasCommand", "/usr/java/bin/java").Return(true)
@ -69,9 +68,7 @@ func TestJava(t *testing.T) {
} else { } else {
env.On("Getenv", "JAVA_HOME").Return("") env.On("Getenv", "JAVA_HOME").Return("")
} }
props := properties.Map{
properties.FetchVersion: true,
}
j := &Java{} j := &Java{}
j.Init(props, env) j.Init(props, env)
assert.True(t, j.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case)) assert.True(t, j.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))

View file

@ -100,6 +100,8 @@ const (
LanguageExtensions properties.Property = "extensions" LanguageExtensions properties.Property = "extensions"
// LanguageFolders the list of folders to validate // LanguageFolders the list of folders to validate
LanguageFolders properties.Property = "folders" LanguageFolders properties.Property = "folders"
// CacheVersion allows caching the version number
CacheVersion properties.Property = "cache_version"
) )
func (l *language) Enabled() bool { func (l *language) Enabled() bool {
@ -192,14 +194,29 @@ func (l *language) hasLanguageFolders() bool {
// setVersion parses the version string returned by the command // setVersion parses the version string returned by the command
func (l *language) setVersion() error { func (l *language) setVersion() error {
var lastError error var lastError error
cacheVersion := l.props.GetBool(CacheVersion, false)
for _, command := range l.commands { for _, command := range l.commands {
var versionStr string var versionStr string
var err error var err error
versionKey := fmt.Sprintf("%s_version", command.executable)
versionURL := fmt.Sprintf("%s_version_url", command.executable)
if versionStr, OK := l.env.Cache().Get(versionKey); OK {
version, _ := command.parse(versionStr)
l.version = *version
l.version.Executable = command.executable
l.version.URL, _ = l.env.Cache().Get(versionURL)
return nil
}
if command.getVersion == nil { if command.getVersion == nil {
if !l.env.HasCommand(command.executable) { if !l.env.HasCommand(command.executable) {
lastError = errors.New(noVersion) lastError = errors.New(noVersion)
continue continue
} }
versionStr, err = l.env.RunCommand(command.executable, command.args...) versionStr, err = l.env.RunCommand(command.executable, command.args...)
if exitErr, ok := err.(*platform.CommandError); ok { if exitErr, ok := err.(*platform.CommandError); ok {
l.exitCode = exitErr.ExitCode l.exitCode = exitErr.ExitCode
@ -213,17 +230,27 @@ func (l *language) setVersion() error {
continue continue
} }
} }
version, err := command.parse(versionStr) version, err := command.parse(versionStr)
if err != nil { if err != nil {
lastError = fmt.Errorf("err parsing info from %s with %s", command.executable, versionStr) lastError = fmt.Errorf("err parsing info from %s with %s", command.executable, versionStr)
continue continue
} }
l.version = *version l.version = *version
if command.versionURLTemplate != "" { if command.versionURLTemplate != "" {
l.versionURLTemplate = command.versionURLTemplate l.versionURLTemplate = command.versionURLTemplate
} }
l.buildVersionURL() l.buildVersionURL()
l.version.Executable = command.executable l.version.Executable = command.executable
if cacheVersion {
timeout := l.props.GetInt(properties.CacheTimeout, 1440)
l.env.Cache().Set(versionKey, versionStr, timeout)
l.env.Cache().Set(versionURL, l.version.URL, timeout)
}
return nil return nil
} }
if lastError != nil { if lastError != nil {

View file

@ -28,6 +28,7 @@ type languageArgs struct {
properties properties.Properties properties properties.Properties
matchesVersionFile matchesVersionFile matchesVersionFile matchesVersionFile
inHome bool inHome bool
cachedVersion string
} }
func (l *languageArgs) hasvalue(value string, list []string) bool { func (l *languageArgs) hasvalue(value string, list []string) bool {
@ -41,27 +42,38 @@ func (l *languageArgs) hasvalue(value string, list []string) bool {
func bootStrapLanguageTest(args *languageArgs) *language { func bootStrapLanguageTest(args *languageArgs) *language {
env := new(mock.MockedEnvironment) env := new(mock.MockedEnvironment)
for _, command := range args.commands { for _, command := range args.commands {
env.On("HasCommand", command.executable).Return(args.hasvalue(command.executable, args.enabledCommands)) env.On("HasCommand", command.executable).Return(args.hasvalue(command.executable, args.enabledCommands))
env.On("RunCommand", command.executable, command.args).Return(args.version, args.expectedError) env.On("RunCommand", command.executable, command.args).Return(args.version, args.expectedError)
} }
for _, extension := range args.extensions { for _, extension := range args.extensions {
env.On("HasFiles", extension).Return(args.hasvalue(extension, args.enabledExtensions)) env.On("HasFiles", extension).Return(args.hasvalue(extension, args.enabledExtensions))
} }
home := "/usr/home" home := "/usr/home"
cwd := "/usr/home/project" cwd := "/usr/home/project"
if args.inHome { if args.inHome {
cwd = home cwd = home
} }
env.On("Pwd").Return(cwd) env.On("Pwd").Return(cwd)
env.On("Home").Return(home) env.On("Home").Return(home)
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil) env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{ env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string), Env: make(map[string]string),
}) })
cache := &mock.MockedCache{}
cache.On("Get", mock2.Anything).Return(args.cachedVersion, len(args.cachedVersion) > 0)
cache.On("Set", mock2.Anything, mock2.Anything, mock2.Anything)
env.On("Cache").Return(cache)
if args.properties == nil { if args.properties == nil {
args.properties = properties.Map{} args.properties = properties.Map{}
} }
l := &language{ l := &language{
props: args.properties, props: args.properties,
env: env, env: env,
@ -70,6 +82,7 @@ func bootStrapLanguageTest(args *languageArgs) *language {
versionURLTemplate: args.versionURLTemplate, versionURLTemplate: args.versionURLTemplate,
matchesVersionFile: args.matchesVersionFile, matchesVersionFile: args.matchesVersionFile,
} }
return l return l
} }
@ -524,3 +537,58 @@ func TestLanguageHyperlinkTemplatePropertyTakesPriority(t *testing.T) {
assert.True(t, lang.Enabled()) assert.True(t, lang.Enabled())
assert.Equal(t, "https://custom/url/template/1.3", lang.version.URL) assert.Equal(t, "https://custom/url/template/1.3", lang.version.URL)
} }
func TestLanguageEnabledCachedVersion(t *testing.T) {
props := properties.Map{
properties.FetchVersion: true,
}
args := &languageArgs{
commands: []*cmd{
{
executable: "unicorn",
args: []string{"--version"},
regex: "(?P<version>.*)",
},
},
extensions: []string{uni, corn},
enabledExtensions: []string{uni, corn},
enabledCommands: []string{"unicorn"},
version: universion,
cachedVersion: "1.3.37",
properties: props,
}
lang := bootStrapLanguageTest(args)
assert.True(t, lang.Enabled())
assert.Equal(t, "1.3.37", lang.Full, "cached unicorn version is available")
assert.Equal(t, "unicorn", lang.Executable, "cached version was found")
}
type mockedLanguageParams struct {
cmd string
versionParam string
versionOutput string
extension string
}
func getMockedLanguageEnv(params *mockedLanguageParams) (*mock.MockedEnvironment, properties.Map) {
env := new(mock.MockedEnvironment)
env.On("HasCommand", params.cmd).Return(true)
env.On("RunCommand", params.cmd, []string{params.versionParam}).Return(params.versionOutput, nil)
env.On("HasFiles", params.extension).Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
props := properties.Map{
properties.FetchVersion: true,
}
cache := &mock.MockedCache{}
cache.On("Get", mock2.Anything).Return("", false)
cache.On("Set", mock2.Anything, mock2.Anything, mock2.Anything)
env.On("Cache").Return(cache)
return env, props
}

View file

@ -5,12 +5,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
func TestLua(t *testing.T) { func TestLua(t *testing.T) {
@ -59,24 +54,27 @@ func TestLua(t *testing.T) {
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "lua").Return(tc.HasLua) cmd: "lua",
env.On("RunCommand", "lua", []string{"-v"}).Return(tc.Version, nil) versionParam: "-v",
versionOutput: tc.Version,
extension: "*.lua",
}
env, props := getMockedLanguageEnv(params)
if !tc.HasLua {
env.Unset("HasCommand")
env.On("HasCommand", "lua").Return(false)
}
env.On("HasCommand", "luajit").Return(tc.HasLuaJit) env.On("HasCommand", "luajit").Return(tc.HasLuaJit)
env.On("RunCommand", "luajit", []string{"-v"}).Return(tc.Version, nil) env.On("RunCommand", "luajit", []string{"-v"}).Return(tc.Version, nil)
env.On("HasFiles", "*.lua").Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props := properties.Map{
properties.FetchVersion: true,
}
props[PreferredExecutable] = tc.Prefer props[PreferredExecutable] = tc.Prefer
l := &Lua{} l := &Lua{}
l.Init(props, env) l.Init(props, env)
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case) failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
assert.True(t, l.Enabled(), failMsg) assert.True(t, l.Enabled(), failMsg)
assert.Equal(t, tc.ExpectedString, renderTemplate(env, l.Template(), l), failMsg) assert.Equal(t, tc.ExpectedString, renderTemplate(env, l.Template(), l), failMsg)

View file

@ -4,9 +4,6 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -30,15 +27,14 @@ func TestPerl(t *testing.T) {
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "perl").Return(true) cmd: "perl",
env.On("RunCommand", "perl", []string{"-version"}).Return(tc.Version, nil) versionParam: "-version",
env.On("HasFiles", ".perl-version").Return(true) versionOutput: tc.Version,
env.On("Pwd").Return("/usr/home/project") extension: ".perl-version",
env.On("Home").Return("/usr/home")
props := properties.Map{
properties.FetchVersion: true,
} }
env, props := getMockedLanguageEnv(params)
p := &Perl{} p := &Perl{}
p.Init(props, env) p.Init(props, env)
assert.True(t, p.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case)) assert.True(t, p.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))

View file

@ -90,13 +90,17 @@ func TestPythonTemplate(t *testing.T) {
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
cmd: "python",
versionParam: "--version",
versionOutput: "Python 3.8.4",
extension: "*.py",
}
env, props := getMockedLanguageEnv(params)
env.On("GOOS").Return("") env.On("GOOS").Return("")
env.On("HasCommand", "python").Return(true)
env.On("CommandPath", mock2.Anything).Return(tc.PythonPath) env.On("CommandPath", mock2.Anything).Return(tc.PythonPath)
env.On("RunCommand", "python", []string{"--version"}).Return("Python 3.8.4", nil)
env.On("RunCommand", "pyenv", []string{"version-name"}).Return(tc.VirtualEnvName, nil) env.On("RunCommand", "pyenv", []string{"version-name"}).Return(tc.VirtualEnvName, nil)
env.On("HasFiles", "*.py").Return(true)
env.On("HasFilesInDir", mock2.Anything, "pyvenv.cfg").Return(len(tc.PyvenvCfg) > 0) env.On("HasFilesInDir", mock2.Anything, "pyvenv.cfg").Return(len(tc.PyvenvCfg) > 0)
env.On("FileContent", filepath.Join(filepath.Dir(tc.PythonPath), "pyvenv.cfg")).Return(tc.PyvenvCfg) env.On("FileContent", filepath.Join(filepath.Dir(tc.PythonPath), "pyvenv.cfg")).Return(tc.PyvenvCfg)
env.On("Getenv", "VIRTUAL_ENV").Return(tc.VirtualEnvName) env.On("Getenv", "VIRTUAL_ENV").Return(tc.VirtualEnvName)
@ -104,18 +108,12 @@ func TestPythonTemplate(t *testing.T) {
env.On("Getenv", "CONDA_DEFAULT_ENV").Return(tc.VirtualEnvName) env.On("Getenv", "CONDA_DEFAULT_ENV").Return(tc.VirtualEnvName)
env.On("Getenv", "PYENV_ROOT").Return("/home/user/.pyenv") env.On("Getenv", "PYENV_ROOT").Return("/home/user/.pyenv")
env.On("PathSeparator").Return("") env.On("PathSeparator").Return("")
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("ResolveSymlink", mock2.Anything).Return(tc.ResolveSymlink.Path, tc.ResolveSymlink.Err) env.On("ResolveSymlink", mock2.Anything).Return(tc.ResolveSymlink.Path, tc.ResolveSymlink.Err)
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
props := properties.Map{ props[properties.FetchVersion] = tc.FetchVersion
properties.FetchVersion: tc.FetchVersion, props[UsePythonVersionFile] = true
UsePythonVersionFile: true, props[DisplayMode] = DisplayModeAlways
DisplayMode: DisplayModeAlways,
}
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
python := &Python{} python := &Python{}
python.Init(props, env) python.Init(props, env)
assert.Equal(t, !tc.ExpectedDisabled, python.Enabled(), tc.Case) assert.Equal(t, !tc.ExpectedDisabled, python.Enabled(), tc.Case)

View file

@ -6,10 +6,7 @@ import (
"testing" "testing"
"github.com/alecthomas/assert" "github.com/alecthomas/assert"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
mock2 "github.com/stretchr/testify/mock"
) )
func TestQuasar(t *testing.T) { func TestQuasar(t *testing.T) {
@ -58,24 +55,20 @@ func TestQuasar(t *testing.T) {
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
env.On("HasCommand", "quasar").Return(true) cmd: "quasar",
env.On("RunCommand", "quasar", []string{"--version"}).Return(tc.Version, nil) versionParam: "--version",
env.On("Pwd").Return("/usr/home/project") versionOutput: tc.Version,
env.On("Home").Return("/usr/home") extension: "quasar.config",
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil) }
env.On("TemplateCache").Return(&platform.TemplateCache{ env, props := getMockedLanguageEnv(params)
Env: make(map[string]string),
})
env.On("HasFilesInDir", "/usr/home/project", "package-lock.json").Return(tc.HasPackageLockFile) env.On("HasFilesInDir", "/usr/home/project", "package-lock.json").Return(tc.HasPackageLockFile)
fileInfo := &platform.FileInfo{ParentFolder: "/usr/home/project", IsDir: true} fileInfo := &platform.FileInfo{ParentFolder: "/usr/home/project", IsDir: true}
env.On("HasParentFilePath", "quasar.config").Return(fileInfo, nil) env.On("HasParentFilePath", "quasar.config").Return(fileInfo, nil)
env.On("FileContent", filepath.Join(fileInfo.ParentFolder, "package-lock.json")).Return(packageLockFile) env.On("FileContent", filepath.Join(fileInfo.ParentFolder, "package-lock.json")).Return(packageLockFile)
props := properties.Map{ props[FetchDependencies] = tc.FetchDependencies
properties.FetchVersion: true,
FetchDependencies: tc.FetchDependencies,
}
quasar := &Quasar{} quasar := &Quasar{}
quasar.Init(props, env) quasar.Init(props, env)

View file

@ -4,12 +4,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
func TestR(t *testing.T) { func TestR(t *testing.T) {
@ -36,25 +31,22 @@ func TestR(t *testing.T) {
{Case: "R.exe 4.0.0", ExpectedString: "4.0.0", HasRexe: true, Version: "R version 4.0.0 (2020-04-24) -- \"Arbor Day\""}, {Case: "R.exe 4.0.0", ExpectedString: "4.0.0", HasRexe: true, Version: "R version 4.0.0 (2020-04-24) -- \"Arbor Day\""},
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
cmd: "R",
versionParam: "--version",
versionOutput: tc.Version,
extension: "*.R",
}
env, props := getMockedLanguageEnv(params)
env.On("HasCommand", "Rscript").Return(tc.HasRscript) env.On("HasCommand", "Rscript").Return(tc.HasRscript)
env.On("RunCommand", "Rscript", []string{"--version"}).Return(tc.Version, nil) env.On("RunCommand", "Rscript", []string{"--version"}).Return(tc.Version, nil)
env.On("HasCommand", "R").Return(tc.HasR)
env.On("RunCommand", "R", []string{"--version"}).Return(tc.Version, nil)
env.On("HasCommand", "R.exe").Return(tc.HasRexe) env.On("HasCommand", "R.exe").Return(tc.HasRexe)
env.On("RunCommand", "R.exe", []string{"--version"}).Return(tc.Version, nil) env.On("RunCommand", "R.exe", []string{"--version"}).Return(tc.Version, nil)
env.On("HasFiles", "*.R").Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props := properties.Map{
properties.FetchVersion: true,
}
r := &R{} r := &R{}
r.Init(props, env) r.Init(props, env)
assert.True(t, r.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case)) assert.True(t, r.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))
assert.Equal(t, tc.ExpectedString, renderTemplate(env, r.Template(), r), fmt.Sprintf("Failed in case: %s", tc.Case)) assert.Equal(t, tc.ExpectedString, renderTemplate(env, r.Template(), r), fmt.Sprintf("Failed in case: %s", tc.Case))
} }

View file

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/properties" "github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -12,80 +11,79 @@ import (
func TestRuby(t *testing.T) { func TestRuby(t *testing.T) {
cases := []struct { cases := []struct {
Case string Case string
ExpectedString string ExpectedString string
ExpectedEnabled bool HasRbenv bool
HasRbenv bool HasRvmprompt bool
HasRvmprompt bool HasChruby bool
HasChruby bool HasAsdf bool
HasAsdf bool HasRuby bool
HasRuby bool Version string
Version string HasRubyFiles bool
HasRubyFiles bool HasRakeFile bool
HasRakeFile bool HasGemFile bool
HasGemFile bool FetchVersion bool
FetchVersion bool
}{ }{
{Case: "No files", ExpectedString: "", ExpectedEnabled: false}, {Case: "Ruby files", ExpectedString: "", FetchVersion: false, HasRubyFiles: true},
{Case: "Ruby files", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRubyFiles: true}, {Case: "Rakefile", ExpectedString: "", FetchVersion: false, HasRakeFile: true},
{Case: "Rakefile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRakeFile: true}, {Case: "Gemfile", ExpectedString: "", FetchVersion: false, HasGemFile: true},
{Case: "Gemfile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasGemFile: true}, {Case: "Gemfile with version", ExpectedString: "err parsing info from ruby with", 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: "Version with chruby", Case: "Version with chruby",
ExpectedString: "ruby-2.6.3", ExpectedString: "ruby-2.6.3",
ExpectedEnabled: true, FetchVersion: true,
FetchVersion: true, HasRubyFiles: true,
HasRubyFiles: true, HasChruby: true,
HasChruby: true,
Version: ` * ruby-2.6.3 Version: ` * ruby-2.6.3
ruby-1.9.3-p392 ruby-1.9.3-p392
jruby-1.7.0 jruby-1.7.0
rubinius-2.0.0-rc1`, rubinius-2.0.0-rc1`,
}, },
{ {
Case: "Version with chruby line 2", Case: "Version with chruby line 2",
ExpectedString: "ruby-1.9.3-p392", ExpectedString: "ruby-1.9.3-p392",
ExpectedEnabled: true, FetchVersion: true,
FetchVersion: true, HasRubyFiles: true,
HasRubyFiles: true, HasChruby: true,
HasChruby: true,
Version: ` ruby-2.6.3 Version: ` ruby-2.6.3
* ruby-1.9.3-p392 * ruby-1.9.3-p392
jruby-1.7.0 jruby-1.7.0
rubinius-2.0.0-rc1`, rubinius-2.0.0-rc1`,
}, },
{ {
Case: "Version with asdf", Case: "Version with asdf",
ExpectedString: "2.6.3", ExpectedString: "2.6.3",
ExpectedEnabled: true, FetchVersion: true,
FetchVersion: true, HasRubyFiles: true,
HasRubyFiles: true, HasAsdf: true,
HasAsdf: true, Version: "ruby 2.6.3 /Users/jan/Projects/oh-my-posh/.tool-versions",
Version: "ruby 2.6.3 /Users/jan/Projects/oh-my-posh/.tool-versions",
}, },
{ {
Case: "Version with asdf not set", Case: "Version with asdf not set",
ExpectedString: "", ExpectedString: "",
ExpectedEnabled: true, FetchVersion: true,
FetchVersion: true, HasRubyFiles: true,
HasRubyFiles: true, HasAsdf: true,
HasAsdf: true, Version: "ruby ______ No version set. Run \"asdf <global|shell|local> ruby <version>\"",
Version: "ruby ______ No version set. Run \"asdf <global|shell|local> ruby <version>\"",
}, },
{ {
Case: "Version with ruby", Case: "Version with ruby",
ExpectedString: "2.6.3", ExpectedString: "2.6.3",
ExpectedEnabled: true, FetchVersion: true,
FetchVersion: true, HasRubyFiles: true,
HasRubyFiles: true, HasRuby: true,
HasRuby: true, Version: "ruby 2.6.3 (2019-04-16 revision 67580) [universal.x86_64-darwin20]",
Version: "ruby 2.6.3 (2019-04-16 revision 67580) [universal.x86_64-darwin20]",
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := new(mock.MockedEnvironment) params := &mockedLanguageParams{
cmd: "ruby",
versionParam: "--version",
versionOutput: tc.Version,
extension: "*.rb",
}
env, props := getMockedLanguageEnv(params)
env.On("HasCommand", "rbenv").Return(tc.HasRbenv) env.On("HasCommand", "rbenv").Return(tc.HasRbenv)
env.On("RunCommand", "rbenv", []string{"version-name"}).Return(tc.Version, nil) env.On("RunCommand", "rbenv", []string{"version-name"}).Return(tc.Version, nil)
env.On("HasCommand", "rvm-prompt").Return(tc.HasRvmprompt) env.On("HasCommand", "rvm-prompt").Return(tc.HasRvmprompt)
@ -94,19 +92,15 @@ func TestRuby(t *testing.T) {
env.On("RunCommand", "chruby", []string(nil)).Return(tc.Version, nil) env.On("RunCommand", "chruby", []string(nil)).Return(tc.Version, nil)
env.On("HasCommand", "asdf").Return(tc.HasAsdf) env.On("HasCommand", "asdf").Return(tc.HasAsdf)
env.On("RunCommand", "asdf", []string{"current", "ruby"}).Return(tc.Version, nil) env.On("RunCommand", "asdf", []string{"current", "ruby"}).Return(tc.Version, nil)
env.On("HasCommand", "ruby").Return(tc.HasRuby)
env.On("RunCommand", "ruby", []string{"--version"}).Return(tc.Version, nil)
env.On("HasFiles", "*.rb").Return(tc.HasRubyFiles)
env.On("HasFiles", "Rakefile").Return(tc.HasRakeFile) env.On("HasFiles", "Rakefile").Return(tc.HasRakeFile)
env.On("HasFiles", "Gemfile").Return(tc.HasGemFile) env.On("HasFiles", "Gemfile").Return(tc.HasGemFile)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home") props[properties.FetchVersion] = tc.FetchVersion
props := properties.Map{
properties.FetchVersion: tc.FetchVersion,
}
ruby := &Ruby{} ruby := &Ruby{}
ruby.Init(props, env) ruby.Init(props, env)
assert.Equal(t, tc.ExpectedEnabled, ruby.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))
assert.True(t, ruby.Enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))
assert.Equal(t, tc.ExpectedString, renderTemplate(env, ruby.Template(), ruby), fmt.Sprintf("Failed in case: %s", tc.Case)) assert.Equal(t, tc.ExpectedString, renderTemplate(env, ruby.Template(), ruby), fmt.Sprintf("Failed in case: %s", tc.Case))
} }
} }

View file

@ -6,11 +6,8 @@ import (
"testing" "testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock" "github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
) )
const ( const (
@ -21,7 +18,6 @@ type testCase struct {
Case string Case string
Template string Template string
ExpectedString string ExpectedString string
ExpectedEnabled bool
UI5YamlFilename string UI5YamlFilename string
WorkingDir string WorkingDir string
Version string Version string
@ -33,7 +29,6 @@ func TestUI5Tooling(t *testing.T) {
{ {
Case: "1) ui5tooling 2.12.1 - file ui5.yaml present in cwd; DisplayMode = files", Case: "1) ui5tooling 2.12.1 - file ui5.yaml present in cwd; DisplayMode = files",
ExpectedString: "2.12.1", ExpectedString: "2.12.1",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml", UI5YamlFilename: "ui5.yaml",
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`, Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeFiles, DisplayMode: DisplayModeFiles,
@ -41,7 +36,6 @@ func TestUI5Tooling(t *testing.T) {
{ {
Case: "2) ui5tooling 2.12.2 - file ui5.yaml present in cwd; default display mode (context)", Case: "2) ui5tooling 2.12.2 - file ui5.yaml present in cwd; default display mode (context)",
ExpectedString: "2.12.2", ExpectedString: "2.12.2",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml", UI5YamlFilename: "ui5.yaml",
Version: `2.12.2 (from C:\somewhere\cli\bin\ui5.js)`, Version: `2.12.2 (from C:\somewhere\cli\bin\ui5.js)`,
}, },
@ -49,98 +43,59 @@ func TestUI5Tooling(t *testing.T) {
Case: "3) ui5tooling 2.12.3 - file ui5.yaml present; cwd is sub dir, default display mode (context)", Case: "3) ui5tooling 2.12.3 - file ui5.yaml present; cwd is sub dir, default display mode (context)",
ExpectedString: "2.12.3", ExpectedString: "2.12.3",
WorkingDir: WorkingDirRoot + "/subdir", WorkingDir: WorkingDirRoot + "/subdir",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml", UI5YamlFilename: "ui5.yaml",
Version: `2.12.3 (from C:\somewhere\cli\bin\ui5.js)`, Version: `2.12.3 (from C:\somewhere\cli\bin\ui5.js)`,
}, },
{
Case: "4) no ui5tooling segment - file ui5.yaml present, cwd is sub dir; display mode = files",
ExpectedString: "",
WorkingDir: WorkingDirRoot + "/subdir",
ExpectedEnabled: false,
UI5YamlFilename: "ui5.yaml",
DisplayMode: DisplayModeFiles,
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`,
},
{ {
Case: "5) ui5tooling 2.12.4 - file ui5-dist.yml present in cwd", Case: "5) ui5tooling 2.12.4 - file ui5-dist.yml present in cwd",
ExpectedString: "2.12.4", ExpectedString: "2.12.4",
ExpectedEnabled: true,
UI5YamlFilename: "ui5-dist.yml", UI5YamlFilename: "ui5-dist.yml",
Version: `2.12.4 (from C:\somewhere\cli\bin\ui5.js)`, Version: `2.12.4 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeFiles, DisplayMode: DisplayModeFiles,
}, },
{ {
Case: "6) no ui5tooling segment - file ui5.yaml not present, display mode = files", Case: "8) ui5tooling 11.0.0-rc1, no ui5.yaml file but display mode = always",
ExpectedString: "", Template: "{{ .Major }}",
ExpectedEnabled: false, ExpectedString: "11",
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`, Version: `11.0.0-rc1 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeFiles, DisplayMode: DisplayModeAlways,
},
{
Case: "7) no ui5tooling segment - file ui5.yaml not present, default display mode (context)",
ExpectedString: "",
ExpectedEnabled: false,
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`,
},
{
Case: "8) ui5tooling 11.0.0-rc1, no ui5.yaml file but display mode = always",
Template: "{{ .Major }}",
ExpectedString: "11",
ExpectedEnabled: true,
Version: `11.0.0-rc1 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeAlways,
}, },
} }
for _, tc := range cases { for _, tc := range cases {
env := prepareMockedEnvironment(&tc) params := &mockedLanguageParams{
ui5tooling := &UI5Tooling{} cmd: "ui5",
versionParam: "--version",
if tc.WorkingDir == "" { versionOutput: tc.Version,
tc.WorkingDir = WorkingDirRoot extension: UI5ToolingYamlPattern,
} }
env, props := getMockedLanguageEnv(params)
if tc.DisplayMode == "" { if len(tc.DisplayMode) == 0 {
tc.DisplayMode = DisplayModeContext tc.DisplayMode = DisplayModeContext
} }
if tc.Template == "" { props[DisplayMode] = tc.DisplayMode
tc.Template = ui5tooling.Template()
}
props := properties.Map{
DisplayMode: tc.DisplayMode,
}
ui5tooling := &UI5Tooling{}
ui5tooling.Init(props, env) ui5tooling.Init(props, env)
err := mockFilePresence(&tc, ui5tooling, env) err := mockFilePresence(&tc, ui5tooling, env)
if err != nil { if err != nil {
t.Fail() t.Fail()
} }
if len(tc.Template) == 0 {
tc.Template = ui5tooling.Template()
}
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case) failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
assert.Equal(t, tc.ExpectedEnabled, ui5tooling.Enabled(), failMsg) assert.True(t, ui5tooling.Enabled(), failMsg)
assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, ui5tooling), failMsg) assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, ui5tooling), failMsg)
} }
} }
func prepareMockedEnvironment(tc *testCase) *mock.MockedEnvironment {
var env = new(mock.MockedEnvironment)
env.On("HasCommand", "ui5").Return(true)
env.On("RunCommand", "ui5", []string{"--version"}).Return(tc.Version, nil)
env.On("Home").Return("/home/user")
env.On("Pwd").Return(WorkingDirRoot)
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
return env
}
func mockFilePresence(tc *testCase, ui5tooling *UI5Tooling, env *mock.MockedEnvironment) error { func mockFilePresence(tc *testCase, ui5tooling *UI5Tooling, env *mock.MockedEnvironment) error {
for _, f := range ui5tooling.language.extensions { for _, f := range ui5tooling.language.extensions {
match, err := filepath.Match(f, tc.UI5YamlFilename) match, err := filepath.Match(f, tc.UI5YamlFilename)

View file

@ -10,25 +10,30 @@ Display the currently active [Angular CLI][angular-cli-docs] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "angular", data={{
"style": "powerline", type: "angular",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#000000", powerline_symbol: "\uE0B0",
"background": "#1976d2", foreground: "#000000",
"template": " \uE753 {{ .Full }} " background: "#1976d2",
}}/> template: " \uE753 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` | | `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `angular.json` file is present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `angular.json` file is present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,29 +10,34 @@ Display the currently active [Azure Functions CLI][az-func-core-tools] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "azfunc", data={{
"style": "powerline", type: "azfunc",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#FEAC19", foreground: "#ffffff",
"template": " \uf0e7 {{ .Full }} ", background: "#FEAC19",
"properties": { template: " \uf0e7 {{ .Full }} ",
"fetch_version": true, properties: {
"display_mode": "files" fetch_version: true,
} display_mode: "files",
}}/> },
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the Azure Functions CLI version - defaults to `true` | | `fetch_version` | `boolean` | fetch the Azure Functions CLI version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `host.json` or `local.settings.json` files is present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `host.json` or `local.settings.json` files is present (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -12,24 +12,29 @@ Display the currently active [Bazel][bazel-github] version.
import Config from "@site/src/components/Config.js"; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "bazel", data={{
"style": "powerline", type: "bazel",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#43a047", foreground: "#ffffff",
}}/> background: "#43a047",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the Bazel version - defaults to `true` | | `fetch_version` | `boolean` | display the Bazel version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.bazel`, `*.bzl`, `.bazelrc`, `.bazelversion`, `BUILD` or `WORKSPACE` files or any of Bazel's output folders are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.bazel`, `*.bzl`, `.bazelrc`, `.bazelversion`, `BUILD` or `WORKSPACE` files or any of Bazel's output folders are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info documentation | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info documentation |
| `icon` | `string` | the icon for the segment - defaults to `"\ue63a"` | | `icon` | `string` | the icon for the segment - defaults to `"\ue63a"` |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,23 +10,28 @@ Display the currently active [Buf CLI][buf-docs] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "buf", data={{
"style": "plain", type: "buf",
"foreground": "#1000D6", style: "plain",
"template": " 🐃 {{ .Full }} " foreground: "#1000D6",
}}/> template: " 🐃 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `buf` | | `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `buf` |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `buf.yaml`, `buf.gen.yaml` or `buf.work.yaml` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `buf.yaml`, `buf.gen.yaml` or `buf.work.yaml` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the active [CDS CLI][sap-cap-cds] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"background": "#a7cae1", data={{
"foreground": "#100e23", background: "#a7cae1",
"powerline_symbol": "\ue0b0", foreground: "#100e23",
"template": " \ue311 cds {{ .Full }} ", powerline_symbol: "\ue0b0",
"style": "powerline", template: " \ue311 cds {{ .Full }} ",
"type": "cds" style: "powerline",
}}/> type: "cds",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the CDS version - defaults to `true` | | `fetch_version` | `boolean` | fetch the CDS version - defaults to `true` |
| `missing_command_text` | `string` | text to display when the cds command is missing - defaults to empty | | `missing_command_text` | `string` | text to display when the cds command is missing - defaults to empty |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is displayed when `.cdsrc.json`, `.cdsrc-private` or `*.cds` file is present</li><li>`context`: the segment is displayed when conditions from `files` mode are fulfilled or `package.json` file is present and `@sap/cds` is in `dependencies` section (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is displayed when `.cdsrc.json`, `.cdsrc-private` or `*.cds` file is present</li><li>`context`: the segment is displayed when conditions from `files` mode are fulfilled or `package.json` file is present and `@sap/cds` is in `dependencies` section (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the active [Cloud Foundry CLI][cloud-foundry] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"background": "#a7cae1", data={{
"foreground": "#100e23", background: "#a7cae1",
"powerline_symbol": "\ue0b0", foreground: "#100e23",
"template": " \uf40a cf {{ .Full }} ", powerline_symbol: "\ue0b0",
"style": "powerline", template: " \uf40a cf {{ .Full }} ",
"type": "cf" style: "powerline",
}}/> type: "cf",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the Cloud Foundry CLI version - defaults to `true` | | `fetch_version` | `boolean` | display the Cloud Foundry CLI version - 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 |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is displayed when `manifest.yml` or `mta.yaml` file is present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is displayed when `manifest.yml` or `mta.yaml` file is present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active [Cmake][cmake-github] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "cmake", data={{
"style": "powerline", type: "cmake",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#E8EAEE", powerline_symbol: "\uE0B0",
"background": "#1E9748", foreground: "#E8EAEE",
"template": " \ue61e \ue61d cmake {{ .Full }} " background: "#1E9748",
}}/> template: " \ue61e \ue61d cmake {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the cmake version - defaults to `true` | | `fetch_version` | `boolean` | display the cmake version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.cmake` or `CMakeLists.txt` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.cmake` or `CMakeLists.txt` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active crystal version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "crystal", data={{
"style": "powerline", type: "crystal",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \uE370 {{ .Full }} " background: "#4063D8",
}}/> template: " \uE370 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the julia version - defaults to `true` | | `fetch_version` | `boolean` | fetch the julia version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.cr` or `shard.yml` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.cr` or `shard.yml` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active dart version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "dart", data={{
"style": "powerline", type: "dart",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#06A4CE", foreground: "#ffffff",
"template": " \uE798 {{ .Full }} " background: "#06A4CE",
}}/> template: " \uE798 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the dart version - defaults to `true` | | `fetch_version` | `boolean` | fetch the dart version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,23 +10,28 @@ Display the currently active [Deno CLI][deno-docs] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "deno", data={{
"style": "plain", type: "deno",
"foreground": "#3C82F6", style: "plain",
"template": " \ue628 {{ .Full }} " foreground: "#3C82F6",
}}/> template: " \ue628 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `deno` | | `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `deno` |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.ts*`, `*.js` or `deno.json` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.ts*`, `*.js` or `deno.json` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active elixir version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "elixir", data={{
"style": "powerline", type: "elixir",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#422251", foreground: "#ffffff",
"template": " \ue62d {{ .Full }} " background: "#422251",
}}/> template: " \ue62d {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the elixir version - defaults to `true` | | `fetch_version` | `boolean` | fetch the elixir version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.ex` or `*.exs` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.ex` or `*.exs` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active flutter version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "flutter", data={{
"style": "powerline", type: "flutter",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#06A4CE", foreground: "#ffffff",
"template": " \ue28e {{ .Full }} " background: "#06A4CE",
}}/> template: " \ue28e {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the flutter version - defaults to `true` | | `fetch_version` | `boolean` | fetch the flutter version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,27 +10,32 @@ Display the currently active golang version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "go", data={{
"style": "powerline", type: "go",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#7FD5EA", foreground: "#ffffff",
"template": " \u202D\uFCD1 {{ .Full }} " background: "#7FD5EA",
}}/> template: " \u202D\uFCD1 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the golang version - defaults to `true` | | `fetch_version` | `boolean` | display the golang version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.go` or `go.mod` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.go` or `go.mod` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `parse_mod_file` | `boolean` | parse the go.mod file instead of calling `go version` | | `parse_mod_file` | `boolean` | parse the go.mod file instead of calling `go version` |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,27 +10,32 @@ Display the currently active Glasgow Haskell Compiler (GHC) version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "haskell", data={{
"style": "powerline", type: "haskell",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#906cff", powerline_symbol: "\uE0B0",
"background": "#100e23", foreground: "#906cff",
"template": " \ue61f {{ .Full }}" background: "#100e23",
}}/> template: " \ue61f {{ .Full }}",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the GHC version - defaults to `true` | | `fetch_version` | `boolean` | display the GHC version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.hs`, `*.lhs`, `stack.yaml`, `package.yaml`, `*.cabal`, or `cabal.project` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.hs`, `*.lhs`, `stack.yaml`, `package.yaml`, `*.cabal`, or `cabal.project` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `stack_ghc_mode` | `string` | determines when to use `stack ghc` to retrieve the version information. Using `stack ghc` will decrease performance.<ul><li>`never`: never use `stack ghc` (**default**)</li><li>`package`: only use `stack ghc` when `stack.yaml` is in the root of the </li><li>`always`: always use `stack ghc`</li></ul> | | `stack_ghc_mode` | `string` | determines when to use `stack ghc` to retrieve the version information. Using `stack ghc` will decrease performance.<ul><li>`never`: never use `stack ghc` (**default**)</li><li>`package`: only use `stack ghc` when `stack.yaml` is in the root of the </li><li>`always`: always use `stack ghc`</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active java version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "java", data={{
"style": "powerline", type: "java",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \uE738 {{ .Full }}" background: "#4063D8",
}}/> template: " \uE738 {{ .Full }}",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the java version - defaults to `true` | | `fetch_version` | `boolean` | display the java version - 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 |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present<ul><li>`pom.xml`</li><li>`build.gradle.kts`</li><li>`build.sbt`</li><li>`.java-version`</li><li>`.deps.edn`</li><li>`project.clj`</li><li>`build.boot`</li><li>`*.java`</li><li>`*.class`</li><li>`*.gradle`</li><li>`*.jar`</li><li>`*.clj`</li><li>`*.cljc`</li></ul></li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present<ul><li>`pom.xml`</li><li>`build.gradle.kts`</li><li>`build.sbt`</li><li>`.java-version`</li><li>`.deps.edn`</li><li>`project.clj`</li><li>`build.boot`</li><li>`*.java`</li><li>`*.class`</li><li>`*.gradle`</li><li>`*.jar`</li><li>`*.clj`</li><li>`*.cljc`</li></ul></li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active julia version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "julia", data={{
"style": "powerline", type: "julia",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \uE624 {{ .Full }} " background: "#4063D8",
}}/> template: " \uE624 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the julia version - defaults to `true` | | `fetch_version` | `boolean` | display the julia version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.jl` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.jl` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active [Kotlin][kotlin] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "kotlin", data={{
"style": "powerline", type: "kotlin",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#906cff", foreground: "#ffffff",
"template": " <b>K</b> {{ .Full }} " background: "#906cff",
}}/> template: " <b>K</b> {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the kotlin version - defaults to `true` | | `fetch_version` | `boolean` | display the kotlin version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.kt`, `*.kts` or `*.ktm` files are present (**default**) </li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.kt`, `*.kts` or `*.ktm` files are present (**default**) </li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,27 +10,32 @@ Display the currently active [Lua][lua] or [LuaJIT][luajit] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "lua", data={{
"style": "powerline", type: "lua",
"powerline_symbol": "\ue0b0", style: "powerline",
"foreground": "white", powerline_symbol: "\ue0b0",
"background": "blue", foreground: "white",
"template": " \ue620 {{ .Full }} " background: "blue",
}}/> template: " \ue620 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the lua version - defaults to `true` | | `fetch_version` | `boolean` | display the lua version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.lua`, `*.rockspec` files or the `lua` folder are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.lua`, `*.rockspec` files or the `lua` folder are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `preferred_executable` | `string` | the preferred executable to use when fetching the version<ul><li>`lua`: the Lua executable (**default**)</li><li>`luajit`: the LuaJIT executable</li></ul> | | `preferred_executable` | `string` | the preferred executable to use when fetching the version<ul><li>`lua`: the Lua executable (**default**)</li><li>`luajit`: the LuaJIT executable</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -25,16 +25,19 @@ import Config from "@site/src/components/Config.js";
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the Node.js version - defaults to `true` | | `fetch_version` | `boolean` | display the Node.js version - 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` | <ul><li>`always`: The segment is always displayed</li><li>`files`: The segment is only displayed when one of the following files is present (**default**):<ul><li>`*.js`</li><li>`*.ts`</li><li>`package.json`</li><li>`.nvmrc`</li><li>`pnpm-workspace.yaml`</li><li>`.pnpmfile.cjs`</li><li>`.npmrc`</li><li>`.vue`</li></ul></li></ul> | | `display_mode` | `string` | <ul><li>`always`: The segment is always displayed</li><li>`files`: The segment is only displayed when one of the following files is present (**default**):<ul><li>`*.js`</li><li>`*.ts`</li><li>`package.json`</li><li>`.nvmrc`</li><li>`pnpm-workspace.yaml`</li><li>`.pnpmfile.cjs`</li><li>`.npmrc`</li><li>`.vue`</li></ul></li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `fetch_package_manager` | `boolean` | define if the current project uses Yarn or NPM - defaults to `false` | | `fetch_package_manager` | `boolean` | define if the current project uses Yarn or NPM - defaults to `false` |
| `yarn_icon` | `string` | the icon/text to display when using Yarn - defaults to ` \uF011B` | | `yarn_icon` | `string` | the icon/text to display when using Yarn - defaults to ` \uF011B` |
| `npm_icon` | `string` | the icon/text to display when using NPM - defaults to ` \uE71E` | | `npm_icon` | `string` | the icon/text to display when using NPM - defaults to ` \uE71E` |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active [npm][npm-docs] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "npm", data={{
"style": "powerline", type: "npm",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#193549", powerline_symbol: "\uE0B0",
"background": "#ffeb3b", foreground: "#193549",
"template": "\ue71e {{ .Full }} " background: "#ffeb3b",
}}/> template: "\ue71e {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `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 |
| `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` | | `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `package.json` or `package-lock.json` file are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `package.json` or `package-lock.json` file are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active [Nx][nx-docs] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "nx", data={{
"style": "powerline", type: "nx",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#000000", powerline_symbol: "\uE0B0",
"background": "#1976d2", foreground: "#000000",
"template": " \uE753 {{ .Full }} " background: "#1976d2",
}}/> template: " \uE753 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` | | `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `workspace.json` or `nx.json` file is present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `workspace.json` or `nx.json` file is present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,24 +10,29 @@ Display the currently active OCaml version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "ocaml", data={{
"style": "powerline", type: "ocaml",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#d08770", powerline_symbol: "\uE0B0",
"template": " \ue67a {{ .Full }} " foreground: "#d08770",
}}/> template: " \ue67a {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the ocaml version (`ocaml -version`) - defaults to `true` | | `fetch_version` | `boolean` | display the ocaml version (`ocaml -version`) - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active perl version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "perl", data={{
"style": "powerline", type: "perl",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \ue769 {{ .Full }}" background: "#4063D8",
}}/> template: " \ue769 {{ .Full }}",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the perl version - defaults to `true` | | `fetch_version` | `boolean` | display the perl version - defaults to `true` |
| `missing_command_text` | `string` | text to display when the perl command is missing - defaults to empty | | `missing_command_text` | `string` | text to display when the perl command is missing - defaults to empty |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`.perl-version`</li><li>`*.pl`</li><li>`*.p`</li><li>`*.t`</li></ul></li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`.perl-version`</li><li>`*.pl`</li><li>`*.p`</li><li>`*.t`</li></ul></li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active php version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "php", data={{
"style": "powerline", type: "php",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \ue73d {{ .Full }} " background: "#4063D8",
}}/> template: " \ue73d {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the php version - defaults to `true` | | `fetch_version` | `boolean` | display the php version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`*.php`</li><li>`composer.json`</li><li>`composer.lock`</li><li>`.php-version`</li><li>`blade.php`</li></ul></li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`*.php`</li><li>`composer.json`</li><li>`composer.lock`</li><li>`.php-version`</li><li>`blade.php`</li></ul></li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -13,28 +13,33 @@ If your virtual environment is a directory named `venv` or `.venv`, the virtual
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "python", data={{
"style": "powerline", type: "python",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#100e23", powerline_symbol: "\uE0B0",
"background": "#906cff", foreground: "#100e23",
"template": " \uE235 {{ .Full }} " background: "#906cff",
}}/> template: " \uE235 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_virtual_env` | `boolean` | fetch the name of the virtualenv or not - defaults to `true` | | `fetch_virtual_env` | `boolean` | fetch 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`) or not - defaults to `true` | | `display_default` | `boolean` | show the name of the virtualenv when it's default (`system`, `base`) or not - defaults to `true` |
| `fetch_version` | `boolean` | fetch the python version - defaults to `true` | | `fetch_version` | `boolean` | fetch the python version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present:<ul><li>`*.py`</li><li>`*.ipynb`</li><li>`pyproject.toml`</li><li>`venv.bak`</li><li>`venv`</li><li>`.venv`</li></ul></li><li>`environment`: the segment is only displayed when a virtual env is present (**default**)</li><li>`context`: the segment is only displayed when either `environment` or `files` is active</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present:<ul><li>`*.py`</li><li>`*.ipynb`</li><li>`pyproject.toml`</li><li>`venv.bak`</li><li>`venv`</li><li>`.venv`</li></ul></li><li>`environment`: the segment is only displayed when a virtual env is present (**default**)</li><li>`context`: the segment is only displayed when either `environment` or `files` is active</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -26,13 +26,16 @@ import Config from "@site/src/components/Config.js";
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `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 |
| `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` | | `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `fetch_dependencies` | `boolean` | fetch the version number of the `vite` and `@quasar/app-vite` dependencies if present - defaults to `false` | | `fetch_dependencies` | `boolean` | fetch the version number of the `vite` and `@quasar/app-vite` dependencies if present - defaults to `false` |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active [R][r-homepage] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "r", data={{
"style": "powerline", type: "r",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "blue", powerline_symbol: "\uE0B0",
"background": "lightWhite", foreground: "blue",
"template": " R {{ .Full }} " background: "lightWhite",
}}/> template: " R {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the R version - defaults to `true` | | `fetch_version` | `boolean` | display the R version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`*.R`</li><li>`*.Rmd`</li><li>`*.Rsx`</li><li>`*.Rda`</li><li>`*.Rd`</li><li>`*.Rproj`</li><li>`.Rproj.user`</li></ul></li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when one of the following files is present (**default**):<ul><li>`*.R`</li><li>`*.Rmd`</li><li>`*.Rsx`</li><li>`*.Rda`</li><li>`*.Rd`</li><li>`*.Rproj`</li><li>`.Rproj.user`</li></ul></li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active ruby version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "ruby", data={{
"style": "powerline", type: "ruby",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#4063D8", foreground: "#ffffff",
"template": " \uE791 {{ .Full }}" background: "#4063D8",
}}/> template: " \uE791 {{ .Full }}",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the ruby version - defaults to `true` | | `fetch_version` | `boolean` | display the ruby version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rb`, `Gemfile` or `Rakefile` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rb`, `Gemfile` or `Rakefile` files are present (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active rust version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "rust", data={{
"style": "powerline", type: "rust",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#193549", powerline_symbol: "\uE0B0",
"background": "#99908a", foreground: "#193549",
"template": " \uE7a8 {{ .Full }} " background: "#99908a",
}}/> template: " \uE7a8 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the rust version (`rustc --version`) - defaults to `true` | | `fetch_version` | `boolean` | display the rust version (`rustc --version`) - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active [Swift][swift] version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "swift", data={{
"style": "powerline", type: "swift",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#f6553c", foreground: "#ffffff",
"template": " \ue755 {{ .Full }} " background: "#f6553c",
}}/> template: " \ue755 {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the swift version - defaults to `true` | | `fetch_version` | `boolean` | display the swift version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.swift` or `*.SWIFT` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.swift` or `*.SWIFT` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -11,26 +11,31 @@ see [the documentation][ui5-version-help]).
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"background": "#f5a834", data={{
"foreground": "#100e23", background: "#f5a834",
"powerline_symbol": "\ue0b0", foreground: "#100e23",
"template": " \uf0adui5 {{ .Full }} ", powerline_symbol: "\ue0b0",
"style": "powerline", template: " \uf0adui5 {{ .Full }} ",
"type": "ui5tooling" style: "powerline",
}}/> type: "ui5tooling",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the UI5 tooling version - defaults to `true` | | `fetch_version` | `boolean` | display the UI5 tooling version - 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 |
| `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder</li><li>`context`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder or it has been found in the parent folders (check up to 4 levels) (**default**) </li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder</li><li>`context`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder or it has been found in the parent folders (check up to 4 levels) (**default**) </li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,26 +10,31 @@ Display the currently active vala version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "vala", data={{
"style": "powerline", type: "vala",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#5E20A4", foreground: "#ffffff",
"template": " \ue69e {{ .Full }} " background: "#5E20A4",
}}/> template: " \ue69e {{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | fetch the flutter version - defaults to `true` | | `fetch_version` | `boolean` | fetch the flutter version - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.vala` files are present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when `*.vala` files are present (**default**)</li></ul> |
| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,25 +10,30 @@ Display the currently active xmake version.
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "xmake", data={{
"style": "powerline", type: "xmake",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#e0f2f1", powerline_symbol: "\uE0B0",
"background": "#22a079", foreground: "#e0f2f1",
"template": " xmake v{{ .Full }} " background: "#22a079",
}}/> template: " xmake v{{ .Full }} ",
}}
/>
## Properties ## Properties
| Name | Type | Description | | Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | | `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` |
| `fetch_version` | `boolean` | display the xmake version (`xmake --version`) - defaults to `true` | | `fetch_version` | `boolean` | display the xmake version (`xmake --version`) - 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` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `xmake.lua` file is present (**default**)</li></ul> | | `display_mode` | `string` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `xmake.lua` file is present (**default**)</li></ul> |
| `extensions` | `[]string` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | allows to override the list of folders names to validate |
| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` |
## Template ([into][templates]) ## Template ([into][templates])