oh-my-posh/src/segments/kotlin.go
2022-03-03 07:56:09 +01:00

35 lines
737 B
Go

package segments
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
type Kotlin struct {
language
}
func (k *Kotlin) Template() string {
return languageTemplate
}
func (k *Kotlin) Init(props properties.Properties, env environment.Environment) {
k.language = language{
env: env,
props: props,
extensions: []string{"*.kt", "*.kts", "*.ktm"},
commands: []*cmd{
{
executable: "kotlin",
args: []string{"-version"},
regex: `Kotlin version (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
},
},
versionURLTemplate: "https://github.com/JetBrains/kotlin/releases/tag/v{{ .Full }}",
}
}
func (k *Kotlin) Enabled() bool {
return k.language.Enabled()
}