oh-my-posh/src/segments/dart.go
Jan De Dobbeleer c729788676 feat: flutter segment
resolves #2310
2022-05-24 10:31:40 +02:00

41 lines
883 B
Go

package segments
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
var (
dartExtensions = []string{"*.dart", "pubspec.yaml", "pubspec.yml", "pubspec.lock"}
dartFolders = []string{".dart_tool"}
)
type Dart struct {
language
}
func (d *Dart) Template() string {
return languageTemplate
}
func (d *Dart) Init(props properties.Properties, env environment.Environment) {
d.language = language{
env: env,
props: props,
extensions: dartExtensions,
folders: dartFolders,
commands: []*cmd{
{
executable: "dart",
args: []string{"--version"},
regex: `Dart SDK version: (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
},
},
versionURLTemplate: "https://dart.dev/guides/language/evolution#dart-{{ .Major }}{{ .Minor }}",
}
}
func (d *Dart) Enabled() bool {
return d.language.Enabled()
}