oh-my-posh/src/segment_rust.go

31 lines
598 B
Go
Raw Normal View History

2021-07-04 13:53:10 -07:00
package main
import "oh-my-posh/environment"
2021-07-04 13:53:10 -07:00
type rust struct {
2021-12-03 11:19:57 -08:00
language
2021-07-04 13:53:10 -07:00
}
func (r *rust) template() string {
return languageTemplate
2021-07-04 13:53:10 -07:00
}
func (r *rust) init(props Properties, env environment.Environment) {
2021-12-03 11:19:57 -08:00
r.language = language{
2021-07-04 13:53:10 -07:00
env: env,
props: props,
extensions: []string{"*.rs", "Cargo.toml", "Cargo.lock"},
commands: []*cmd{
{
executable: "rustc",
args: []string{"--version"},
regex: `rustc (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
},
},
}
}
func (r *rust) enabled() bool {
return r.language.enabled()
}