2020-10-16 08:43:02 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
type dotnet struct {
|
2020-12-27 23:33:58 -08:00
|
|
|
language *language
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2020-11-12 00:43:32 -08:00
|
|
|
// UnsupportedDotnetVersionIcon is displayed when the dotnet version in
|
|
|
|
// the current folder isn't supported by the installed dotnet SDK set.
|
2020-10-16 08:43:02 -07:00
|
|
|
UnsupportedDotnetVersionIcon Property = "unsupported_version_icon"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (d *dotnet) string() string {
|
2020-12-27 23:33:58 -08:00
|
|
|
version := d.language.string()
|
2020-10-16 08:43:02 -07:00
|
|
|
|
2021-06-16 09:52:42 -07:00
|
|
|
exitCode := d.language.exitCode
|
2021-06-23 13:19:43 -07:00
|
|
|
if exitCode == dotnetExitCode {
|
2020-12-27 23:33:58 -08:00
|
|
|
return d.language.props.getString(UnsupportedDotnetVersionIcon, "\uf071 ")
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
2020-12-27 23:33:58 -08:00
|
|
|
return version
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *dotnet) init(props *properties, env environmentInfo) {
|
2020-12-27 23:33:58 -08:00
|
|
|
d.language = &language{
|
2021-02-03 10:11:32 -08:00
|
|
|
env: env,
|
|
|
|
props: props,
|
2021-10-13 06:30:47 -07:00
|
|
|
extensions: []string{"*.cs", "*.csx", "*.vb", "*.sln", "*.csproj", "*.vbproj", "*.fs", "*.fsx", "*.fsproj", "global.json"},
|
2021-02-03 10:11:32 -08:00
|
|
|
commands: []*cmd{
|
|
|
|
{
|
|
|
|
executable: "dotnet",
|
|
|
|
args: []string{"--version"},
|
|
|
|
regex: `(?:(?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?:\d{2})(?P<patch>[0-9]{1}))))`,
|
|
|
|
},
|
2021-01-10 03:14:43 -08:00
|
|
|
},
|
2021-02-03 10:11:32 -08:00
|
|
|
versionURLTemplate: "[%1s](https://github.com/dotnet/core/blob/master/release-notes/%[2]s.%[3]s/%[2]s.%[3]s.%[4]s/%[2]s.%[3]s.%[4]s.md)",
|
2020-12-27 23:33:58 -08:00
|
|
|
}
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *dotnet) enabled() bool {
|
2020-12-27 23:33:58 -08:00
|
|
|
return d.language.enabled()
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|