oh-my-posh/src/segment_dotnet.go

40 lines
1 KiB
Go
Raw Normal View History

package main
type dotnet struct {
language *language
}
const (
// UnsupportedDotnetVersionIcon is displayed when the dotnet version in
// the current folder isn't supported by the installed dotnet SDK set.
UnsupportedDotnetVersionIcon Property = "unsupported_version_icon"
)
func (d *dotnet) string() string {
version := d.language.string()
// Exit code 145 is a special indicator that dotnet
// ran, but the current project config settings specify
// use of an SDK that isn't installed.
if d.language.exitCode == 145 {
return d.language.props.getString(UnsupportedDotnetVersionIcon, "\uf071 ")
}
return version
}
func (d *dotnet) init(props *properties, env environmentInfo) {
d.language = &language{
env: env,
props: props,
commands: []string{"dotnet"},
versionParam: "--version",
extensions: []string{"*.cs", "*.vb", "*.sln", "*.csproj", "*.vbproj"},
versionRegex: `(?P<version>[0-9]+.[0-9]+.[0-9]+)`,
}
}
func (d *dotnet) enabled() bool {
return d.language.enabled()
}