oh-my-posh/src/segments/crystal.go

35 lines
734 B
Go
Raw Normal View History

2022-01-26 06:54:36 -08:00
package segments
2021-05-14 04:39:49 -07:00
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
2022-01-26 05:10:18 -08:00
type Crystal struct {
2021-12-03 11:19:57 -08:00
language
2021-05-14 04:39:49 -07:00
}
func (c *Crystal) Template() string {
return languageTemplate
2021-05-14 04:39:49 -07:00
}
func (c *Crystal) Init(props properties.Properties, env environment.Environment) {
2021-12-03 11:19:57 -08:00
c.language = language{
2021-05-14 04:39:49 -07:00
env: env,
props: props,
extensions: []string{"*.cr", "shard.yml"},
commands: []*cmd{
{
executable: "crystal",
args: []string{"--version"},
regex: `Crystal (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
},
},
2022-01-23 09:48:55 -08:00
versionURLTemplate: "https://github.com/crystal-lang/crystal/releases/tag/{{ .Full }}",
2021-05-14 04:39:49 -07:00
}
}
func (c *Crystal) Enabled() bool {
return c.language.Enabled()
2021-05-14 04:39:49 -07:00
}