2021-07-04 13:53:10 -07:00
|
|
|
package main
|
|
|
|
|
2022-01-26 04:53:35 -08:00
|
|
|
import (
|
|
|
|
"oh-my-posh/environment"
|
|
|
|
"oh-my-posh/properties"
|
|
|
|
)
|
2022-01-26 01:23:18 -08:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08:00
|
|
|
func (r *Rust) Template() string {
|
2022-01-23 12:37:51 -08:00
|
|
|
return languageTemplate
|
2021-07-04 13:53:10 -07:00
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08: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]+)))`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08:00
|
|
|
func (r *Rust) Enabled() bool {
|
|
|
|
return r.language.Enabled()
|
2021-07-04 13:53:10 -07:00
|
|
|
}
|