oh-my-posh/src/segment_rust.go

34 lines
639 B
Go
Raw Normal View History

2021-07-04 13:53:10 -07:00
package main
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
2022-01-26 05:10:18 -08: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.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()
2021-07-04 13:53:10 -07:00
}