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()
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.
Get(key string) (string, bool)
// 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)
// Deletes a key from the cache.
Delete(key string)

View file

@ -2,13 +2,8 @@ package segments
import (
"fmt"
"path/filepath"
"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"
)
@ -16,8 +11,6 @@ func TestCdsSegment(t *testing.T) {
cases := []struct {
Case string
ExpectedString string
ExpectedEnabled bool
File string
Template string
Version string
PackageJSON string
@ -26,29 +19,18 @@ func TestCdsSegment(t *testing.T) {
{
Case: "1) cds 5.5.0 - file .cdsrc.json present",
ExpectedString: "5.5.0",
ExpectedEnabled: true,
File: ".cdsrc.json",
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",
ExpectedString: "5.5.1",
ExpectedEnabled: true,
File: "some.cds",
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",
ExpectedString: "",
ExpectedEnabled: false,
DisplayMode: DisplayModeFiles,
},
{
Case: "4) cds 5.5.3 - package.json dependency",
ExpectedString: "5.5.3",
ExpectedEnabled: true,
Version: "@sap/cds: 5.5.3\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
PackageJSON: "{ \"name\": \"my-app\",\"dependencies\": { \"@sap/cds\": \"^5\" } }",
DisplayMode: DisplayModeContext,
@ -56,54 +38,41 @@ func TestCdsSegment(t *testing.T) {
{
Case: "4) cds 5.5.4 - package.json dependency, major + minor",
ExpectedString: "5.5",
ExpectedEnabled: true,
Template: "{{ .Major }}.{{ .Minor }}",
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\" } }",
DisplayMode: DisplayModeContext,
},
{
Case: "5) cds 5.5.5 - package.json present, no dependency, no files",
ExpectedString: "",
ExpectedEnabled: false,
Version: "@sap/cds: 5.5.5\n@sap/cds-compiler: 2.7.0\n@sap/cds-dk: 4.5.3",
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 {
var env = new(mock.MockedEnvironment)
env.On("HasCommand", "cds").Return(true)
env.On("RunCommand", "cds", []string{"--version"}).Return(tc.Version, nil)
env.On("Pwd").Return("/usr/home/dev/my-app")
env.On("Home").Return("/usr/home")
params := &mockedLanguageParams{
cmd: "cds",
versionParam: "--version",
versionOutput: tc.Version,
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("FileContent", "package.json").Return(tc.PackageJSON)
} else {
@ -111,37 +80,14 @@ func TestCdsSegment(t *testing.T) {
}
cds := &Cds{}
props := properties.Map{
"display_mode": tc.DisplayMode,
}
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
cds.Init(props, env)
if tc.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)
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)
}
}

View file

@ -2,15 +2,9 @@ package segments
import (
"fmt"
"path/filepath"
"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"
mock2 "github.com/stretchr/testify/mock"
)
func TestCFSegment(t *testing.T) {
@ -18,7 +12,6 @@ func TestCFSegment(t *testing.T) {
Case string
Template string
ExpectedString string
ExpectedEnabled bool
CfYamlFile string
Version string
DisplayMode string
@ -26,7 +19,6 @@ func TestCFSegment(t *testing.T) {
{
Case: "1) cf 2.12.1 - file manifest.yml",
ExpectedString: "2.12.1",
ExpectedEnabled: true,
CfYamlFile: "manifest.yml",
Version: `cf.exe version 2.12.1+645c3ce6a.2021-08-16`,
DisplayMode: DisplayModeFiles,
@ -35,69 +27,39 @@ func TestCFSegment(t *testing.T) {
Case: "2) cf 11.0.0-rc1 - file mta.yaml",
Template: "{{ .Major }}",
ExpectedString: "11",
ExpectedEnabled: true,
CfYamlFile: "mta.yaml",
Version: `cf version 11.0.0-rc1`,
DisplayMode: DisplayModeFiles,
},
{
Case: "3) cf 11.0.0-rc1 - no file",
Template: "{{ .Major }}",
ExpectedString: "",
ExpectedEnabled: false,
Version: `cf version 11.0.0-rc1`,
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 {
var env = new(mock.MockedEnvironment)
env.On("HasCommand", "cf").Return(true)
env.On("RunCommand", "cf", []string{"version"}).Return(tc.Version, nil)
env.On("Pwd").Return("/usr/home/dev/my-app")
env.On("Home").Return("/usr/home")
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
params := &mockedLanguageParams{
cmd: "cf",
versionParam: "version",
versionOutput: tc.Version,
extension: "manifest.yml",
}
env, props := getMockedLanguageEnv(params)
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props[DisplayMode] = tc.DisplayMode
cf := &Cf{}
props := properties.Map{
DisplayMode: tc.DisplayMode,
}
cf.Init(props, env)
if tc.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)
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)
}
}

View file

@ -4,12 +4,9 @@ import (
"testing"
"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/properties"
"github.com/stretchr/testify/assert"
mock2 "github.com/stretchr/testify/mock"
)
func TestDotnetSegment(t *testing.T) {
@ -17,39 +14,30 @@ func TestDotnetSegment(t *testing.T) {
Case string
Expected string
ExitCode int
HasCommand bool
Version string
FetchVersion bool
}{
{Case: "Unsupported version", Expected: "\uf071", HasCommand: true, FetchVersion: true, 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: "", HasCommand: true, FetchVersion: false, Version: "3.1.402"},
{Case: "Regular version", Expected: "", HasCommand: false, FetchVersion: false, Version: "3.1.402"},
{Case: "Unsupported version", Expected: "\uf071", ExitCode: constants.DotnetExitCode, Version: "3.1.402"},
{Case: "Regular version", Expected: "3.1.402", Version: "3.1.402"},
}
for _, tc := range cases {
env := new(mock.MockedEnvironment)
env.On("HasCommand", "dotnet").Return(tc.HasCommand)
params := &mockedLanguageParams{
cmd: "dotnet",
versionParam: "--version",
versionOutput: tc.Version,
extension: "*.cs",
}
env, props := getMockedLanguageEnv(params)
if tc.ExitCode != 0 {
env.Unset("RunCommand")
err := &platform.CommandError{ExitCode: tc.ExitCode}
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.Init(props, env)
assert.True(t, dotnet.Enabled())
assert.Equal(t, tc.Expected, renderTemplate(env, dotnet.Template(), dotnet), tc.Case)
}

View file

@ -6,38 +6,11 @@ import (
"os"
"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"
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) {
cases := []struct {
Case string

View file

@ -5,12 +5,9 @@ import (
"fmt"
"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"
mock2 "github.com/stretchr/testify/mock"
)
func TestHaskell(t *testing.T) {
@ -57,36 +54,32 @@ func TestHaskell(t *testing.T) {
}
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) {
env.On("HasCommand", "stack").Return(true)
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{
Path: "../stack.yaml",
ParentFolder: "./",
IsDir: false,
}
if tc.InStackPackage {
var err error
env.On("HasParentFilePath", "stack.yaml").Return(fileInfo, err)
} else {
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
h := &Haskell{}

View file

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

View file

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

View file

@ -28,6 +28,7 @@ type languageArgs struct {
properties properties.Properties
matchesVersionFile matchesVersionFile
inHome bool
cachedVersion string
}
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 {
env := new(mock.MockedEnvironment)
for _, command := range args.commands {
env.On("HasCommand", command.executable).Return(args.hasvalue(command.executable, args.enabledCommands))
env.On("RunCommand", command.executable, command.args).Return(args.version, args.expectedError)
}
for _, extension := range args.extensions {
env.On("HasFiles", extension).Return(args.hasvalue(extension, args.enabledExtensions))
}
home := "/usr/home"
cwd := "/usr/home/project"
if args.inHome {
cwd = home
}
env.On("Pwd").Return(cwd)
env.On("Home").Return(home)
env.On("DebugF", mock2.Anything, mock2.Anything).Return(nil)
env.On("TemplateCache").Return(&platform.TemplateCache{
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 {
args.properties = properties.Map{}
}
l := &language{
props: args.properties,
env: env,
@ -70,6 +82,7 @@ func bootStrapLanguageTest(args *languageArgs) *language {
versionURLTemplate: args.versionURLTemplate,
matchesVersionFile: args.matchesVersionFile,
}
return l
}
@ -524,3 +537,58 @@ func TestLanguageHyperlinkTemplatePropertyTakesPriority(t *testing.T) {
assert.True(t, lang.Enabled())
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"
"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"
mock2 "github.com/stretchr/testify/mock"
)
func TestLua(t *testing.T) {
@ -59,24 +54,27 @@ func TestLua(t *testing.T) {
},
}
for _, tc := range cases {
env := new(mock.MockedEnvironment)
env.On("HasCommand", "lua").Return(tc.HasLua)
env.On("RunCommand", "lua", []string{"-v"}).Return(tc.Version, nil)
params := &mockedLanguageParams{
cmd: "lua",
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("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
l := &Lua{}
l.Init(props, env)
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
assert.True(t, l.Enabled(), failMsg)
assert.Equal(t, tc.ExpectedString, renderTemplate(env, l.Template(), l), failMsg)

View file

@ -4,9 +4,6 @@ import (
"fmt"
"testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert"
)
@ -30,15 +27,14 @@ func TestPerl(t *testing.T) {
},
}
for _, tc := range cases {
env := new(mock.MockedEnvironment)
env.On("HasCommand", "perl").Return(true)
env.On("RunCommand", "perl", []string{"-version"}).Return(tc.Version, nil)
env.On("HasFiles", ".perl-version").Return(true)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
props := properties.Map{
properties.FetchVersion: true,
params := &mockedLanguageParams{
cmd: "perl",
versionParam: "-version",
versionOutput: tc.Version,
extension: ".perl-version",
}
env, props := getMockedLanguageEnv(params)
p := &Perl{}
p.Init(props, env)
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 {
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("HasCommand", "python").Return(true)
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("HasFiles", "*.py").Return(true)
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("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", "PYENV_ROOT").Return("/home/user/.pyenv")
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("DebugF", mock2.Anything, mock2.Anything).Return(nil)
props := properties.Map{
properties.FetchVersion: tc.FetchVersion,
UsePythonVersionFile: true,
DisplayMode: DisplayModeAlways,
}
env.On("TemplateCache").Return(&platform.TemplateCache{
Env: make(map[string]string),
})
props[properties.FetchVersion] = tc.FetchVersion
props[UsePythonVersionFile] = true
props[DisplayMode] = DisplayModeAlways
python := &Python{}
python.Init(props, env)
assert.Equal(t, !tc.ExpectedDisabled, python.Enabled(), tc.Case)

View file

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

View file

@ -4,12 +4,7 @@ import (
"fmt"
"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"
mock2 "github.com/stretchr/testify/mock"
)
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\""},
}
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("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("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.Init(props, env)
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))
}

View file

@ -4,7 +4,6 @@ import (
"fmt"
"testing"
"github.com/jandedobbeleer/oh-my-posh/src/mock"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/stretchr/testify/assert"
@ -14,7 +13,6 @@ func TestRuby(t *testing.T) {
cases := []struct {
Case string
ExpectedString string
ExpectedEnabled bool
HasRbenv bool
HasRvmprompt bool
HasChruby bool
@ -26,16 +24,13 @@ func TestRuby(t *testing.T) {
HasGemFile bool
FetchVersion bool
}{
{Case: "No files", ExpectedString: "", ExpectedEnabled: false},
{Case: "Ruby files", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRubyFiles: true},
{Case: "Rakefile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRakeFile: true},
{Case: "Gemfile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, 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: "Ruby files", ExpectedString: "", FetchVersion: false, HasRubyFiles: true},
{Case: "Rakefile", ExpectedString: "", FetchVersion: false, HasRakeFile: true},
{Case: "Gemfile", ExpectedString: "", FetchVersion: false, HasGemFile: true},
{Case: "Gemfile with version", ExpectedString: "err parsing info from ruby with", FetchVersion: true, HasGemFile: true},
{
Case: "Version with chruby",
ExpectedString: "ruby-2.6.3",
ExpectedEnabled: true,
FetchVersion: true,
HasRubyFiles: true,
HasChruby: true,
@ -47,7 +42,6 @@ func TestRuby(t *testing.T) {
{
Case: "Version with chruby line 2",
ExpectedString: "ruby-1.9.3-p392",
ExpectedEnabled: true,
FetchVersion: true,
HasRubyFiles: true,
HasChruby: true,
@ -59,7 +53,6 @@ func TestRuby(t *testing.T) {
{
Case: "Version with asdf",
ExpectedString: "2.6.3",
ExpectedEnabled: true,
FetchVersion: true,
HasRubyFiles: true,
HasAsdf: true,
@ -68,7 +61,6 @@ func TestRuby(t *testing.T) {
{
Case: "Version with asdf not set",
ExpectedString: "",
ExpectedEnabled: true,
FetchVersion: true,
HasRubyFiles: true,
HasAsdf: true,
@ -77,7 +69,6 @@ func TestRuby(t *testing.T) {
{
Case: "Version with ruby",
ExpectedString: "2.6.3",
ExpectedEnabled: true,
FetchVersion: true,
HasRubyFiles: true,
HasRuby: true,
@ -85,7 +76,14 @@ func TestRuby(t *testing.T) {
},
}
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("RunCommand", "rbenv", []string{"version-name"}).Return(tc.Version, nil)
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("HasCommand", "asdf").Return(tc.HasAsdf)
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", "Gemfile").Return(tc.HasGemFile)
env.On("Pwd").Return("/usr/home/project")
env.On("Home").Return("/usr/home")
props := properties.Map{
properties.FetchVersion: tc.FetchVersion,
}
props[properties.FetchVersion] = tc.FetchVersion
ruby := &Ruby{}
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))
}
}

View file

@ -6,11 +6,8 @@ import (
"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"
mock2 "github.com/stretchr/testify/mock"
)
const (
@ -21,7 +18,6 @@ type testCase struct {
Case string
Template string
ExpectedString string
ExpectedEnabled bool
UI5YamlFilename string
WorkingDir 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",
ExpectedString: "2.12.1",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml",
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`,
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)",
ExpectedString: "2.12.2",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml",
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)",
ExpectedString: "2.12.3",
WorkingDir: WorkingDirRoot + "/subdir",
ExpectedEnabled: true,
UI5YamlFilename: "ui5.yaml",
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",
ExpectedString: "2.12.4",
ExpectedEnabled: true,
UI5YamlFilename: "ui5-dist.yml",
Version: `2.12.4 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeFiles,
},
{
Case: "6) no ui5tooling segment - file ui5.yaml not present, display mode = files",
ExpectedString: "",
ExpectedEnabled: false,
Version: `2.12.1 (from C:\somewhere\cli\bin\ui5.js)`,
DisplayMode: DisplayModeFiles,
},
{
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 {
env := prepareMockedEnvironment(&tc)
ui5tooling := &UI5Tooling{}
if tc.WorkingDir == "" {
tc.WorkingDir = WorkingDirRoot
params := &mockedLanguageParams{
cmd: "ui5",
versionParam: "--version",
versionOutput: tc.Version,
extension: UI5ToolingYamlPattern,
}
env, props := getMockedLanguageEnv(params)
if tc.DisplayMode == "" {
if len(tc.DisplayMode) == 0 {
tc.DisplayMode = DisplayModeContext
}
if tc.Template == "" {
tc.Template = ui5tooling.Template()
}
props := properties.Map{
DisplayMode: tc.DisplayMode,
}
props[DisplayMode] = tc.DisplayMode
ui5tooling := &UI5Tooling{}
ui5tooling.Init(props, env)
err := mockFilePresence(&tc, ui5tooling, env)
if err != nil {
t.Fail()
}
if len(tc.Template) == 0 {
tc.Template = ui5tooling.Template()
}
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)
}
}
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 {
for _, f := range ui5tooling.language.extensions {
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
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "angular",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#1976d2",
"template": " \uE753 {{ .Full }} "
}}/>
<Config
data={{
type: "angular",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#000000",
background: "#1976d2",
template: " \uE753 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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 |
| `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])

View file

@ -10,29 +10,34 @@ Display the currently active [Azure Functions CLI][az-func-core-tools] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "azfunc",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#FEAC19",
"template": " \uf0e7 {{ .Full }} ",
"properties": {
"fetch_version": true,
"display_mode": "files"
}
}}/>
<Config
data={{
type: "azfunc",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#FEAC19",
template: " \uf0e7 {{ .Full }} ",
properties: {
fetch_version: true,
display_mode: "files",
},
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -12,24 +12,29 @@ Display the currently active [Bazel][bazel-github] version.
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "bazel",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#43a047",
}}/>
<Config
data={{
type: "bazel",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#43a047",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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"` |
| `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])

View file

@ -10,23 +10,28 @@ Display the currently active [Buf CLI][buf-docs] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "buf",
"style": "plain",
"foreground": "#1000D6",
"template": " 🐃 {{ .Full }} "
}}/>
<Config
data={{
type: "buf",
style: "plain",
foreground: "#1000D6",
template: " 🐃 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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 |
| `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])

View file

@ -10,25 +10,30 @@ Display the active [CDS CLI][sap-cap-cds] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"background": "#a7cae1",
"foreground": "#100e23",
"powerline_symbol": "\ue0b0",
"template": " \ue311 cds {{ .Full }} ",
"style": "powerline",
"type": "cds"
}}/>
<Config
data={{
background: "#a7cae1",
foreground: "#100e23",
powerline_symbol: "\ue0b0",
template: " \ue311 cds {{ .Full }} ",
style: "powerline",
type: "cds",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the active [Cloud Foundry CLI][cloud-foundry] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"background": "#a7cae1",
"foreground": "#100e23",
"powerline_symbol": "\ue0b0",
"template": " \uf40a cf {{ .Full }} ",
"style": "powerline",
"type": "cf"
}}/>
<Config
data={{
background: "#a7cae1",
foreground: "#100e23",
powerline_symbol: "\ue0b0",
template: " \uf40a cf {{ .Full }} ",
style: "powerline",
type: "cf",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active [Cmake][cmake-github] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "cmake",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#E8EAEE",
"background": "#1E9748",
"template": " \ue61e \ue61d cmake {{ .Full }} "
}}/>
<Config
data={{
type: "cmake",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#E8EAEE",
background: "#1E9748",
template: " \ue61e \ue61d cmake {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active crystal version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "crystal",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \uE370 {{ .Full }} "
}}/>
<Config
data={{
type: "crystal",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \uE370 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active dart version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "dart",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#06A4CE",
"template": " \uE798 {{ .Full }} "
}}/>
<Config
data={{
type: "dart",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#06A4CE",
template: " \uE798 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,23 +10,28 @@ Display the currently active [Deno CLI][deno-docs] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "deno",
"style": "plain",
"foreground": "#3C82F6",
"template": " \ue628 {{ .Full }} "
}}/>
<Config
data={{
type: "deno",
style: "plain",
foreground: "#3C82F6",
template: " \ue628 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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 |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active elixir version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "elixir",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#422251",
"template": " \ue62d {{ .Full }} "
}}/>
<Config
data={{
type: "elixir",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#422251",
template: " \ue62d {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active flutter version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "flutter",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#06A4CE",
"template": " \ue28e {{ .Full }} "
}}/>
<Config
data={{
type: "flutter",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#06A4CE",
template: " \ue28e {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,27 +10,32 @@ Display the currently active golang version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "go",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#7FD5EA",
"template": " \u202D\uFCD1 {{ .Full }} "
}}/>
<Config
data={{
type: "go",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#7FD5EA",
template: " \u202D\uFCD1 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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` |
| `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])

View file

@ -10,27 +10,32 @@ Display the currently active Glasgow Haskell Compiler (GHC) version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "haskell",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#906cff",
"background": "#100e23",
"template": " \ue61f {{ .Full }}"
}}/>
<Config
data={{
type: "haskell",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#906cff",
background: "#100e23",
template: " \ue61f {{ .Full }}",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active java version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "java",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \uE738 {{ .Full }}"
}}/>
<Config
data={{
type: "java",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \uE738 {{ .Full }}",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active julia version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "julia",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \uE624 {{ .Full }} "
}}/>
<Config
data={{
type: "julia",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \uE624 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active [Kotlin][kotlin] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "kotlin",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#906cff",
"template": " <b>K</b> {{ .Full }} "
}}/>
<Config
data={{
type: "kotlin",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#906cff",
template: " <b>K</b> {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,27 +10,32 @@ Display the currently active [Lua][lua] or [LuaJIT][luajit] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "lua",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "white",
"background": "blue",
"template": " \ue620 {{ .Full }} "
}}/>
<Config
data={{
type: "lua",
style: "powerline",
powerline_symbol: "\ue0b0",
foreground: "white",
background: "blue",
template: " \ue620 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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> |
| `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])

View file

@ -26,7 +26,7 @@ import Config from "@site/src/components/Config.js";
## Properties
| Name | Type | Description |
| ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ----------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty |
@ -35,6 +35,9 @@ import Config from "@site/src/components/Config.js";
| `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` |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active [npm][npm-docs] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "npm",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#ffeb3b",
"template": "\ue71e {{ .Full }} "
}}/>
<Config
data={{
type: "npm",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#193549",
background: "#ffeb3b",
template: "\ue71e {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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 |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active [Nx][nx-docs] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "nx",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#1976d2",
"template": " \uE753 {{ .Full }} "
}}/>
<Config
data={{
type: "nx",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#000000",
background: "#1976d2",
template: " \uE753 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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 |
| `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])

View file

@ -10,24 +10,29 @@ Display the currently active OCaml version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "ocaml",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#d08770",
"template": " \ue67a {{ .Full }} "
}}/>
<Config
data={{
type: "ocaml",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#d08770",
template: " \ue67a {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active perl version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "perl",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \ue769 {{ .Full }}"
}}/>
<Config
data={{
type: "perl",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \ue769 {{ .Full }}",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active php version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "php",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \ue73d {{ .Full }} "
}}/>
<Config
data={{
type: "php",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \ue73d {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -13,21 +13,23 @@ If your virtual environment is a directory named `venv` or `.venv`, the virtual
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "python",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#906cff",
"template": " \uE235 {{ .Full }} "
}}/>
<Config
data={{
type: "python",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#100e23",
background: "#906cff",
template: " \uE235 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `display_default` | `boolean` | show the name of the virtualenv when it's default (`system`, `base`) or not - defaults to `true` |
@ -35,6 +37,9 @@ import Config from '@site/src/components/Config.js';
| `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> |
| `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])

View file

@ -27,12 +27,15 @@ import Config from "@site/src/components/Config.js";
## Properties
| Name | Type | Description |
| ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------- |
| `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 |
| `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 |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active [R][r-homepage] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "r",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "blue",
"background": "lightWhite",
"template": " R {{ .Full }} "
}}/>
<Config
data={{
type: "r",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "blue",
background: "lightWhite",
template: " R {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active ruby version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "ruby",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4063D8",
"template": " \uE791 {{ .Full }}"
}}/>
<Config
data={{
type: "ruby",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#4063D8",
template: " \uE791 {{ .Full }}",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active rust version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "rust",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#99908a",
"template": " \uE7a8 {{ .Full }} "
}}/>
<Config
data={{
type: "rust",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#193549",
background: "#99908a",
template: " \uE7a8 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active [Swift][swift] version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "swift",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#f6553c",
"template": " \ue755 {{ .Full }} "
}}/>
<Config
data={{
type: "swift",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#f6553c",
template: " \ue755 {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -11,26 +11,31 @@ see [the documentation][ui5-version-help]).
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"background": "#f5a834",
"foreground": "#100e23",
"powerline_symbol": "\ue0b0",
"template": " \uf0adui5 {{ .Full }} ",
"style": "powerline",
"type": "ui5tooling"
}}/>
<Config
data={{
background: "#f5a834",
foreground: "#100e23",
powerline_symbol: "\ue0b0",
template: " \uf0adui5 {{ .Full }} ",
style: "powerline",
type: "ui5tooling",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,26 +10,31 @@ Display the currently active vala version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "vala",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#5E20A4",
"template": " \ue69e {{ .Full }} "
}}/>
<Config
data={{
type: "vala",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#5E20A4",
template: " \ue69e {{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])

View file

@ -10,25 +10,30 @@ Display the currently active xmake version.
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "xmake",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#e0f2f1",
"background": "#22a079",
"template": " xmake v{{ .Full }} "
}}/>
<Config
data={{
type: "xmake",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#e0f2f1",
background: "#22a079",
template: " xmake v{{ .Full }} ",
}}
/>
## Properties
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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` |
| `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> |
| `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])