oh-my-posh/segment_node.go

25 lines
494 B
Go
Raw Normal View History

2020-09-17 07:43:45 -07:00
package main
2020-10-01 11:57:02 -07:00
type node struct {
2020-11-14 11:04:04 -08:00
language *language
2020-09-17 07:43:45 -07:00
}
2020-10-01 11:57:02 -07:00
func (n *node) string() string {
2020-11-14 11:04:04 -08:00
return n.language.string()
2020-09-17 07:43:45 -07:00
}
2020-10-01 11:57:02 -07:00
func (n *node) init(props *properties, env environmentInfo) {
2020-11-14 11:04:04 -08:00
n.language = &language{
env: env,
props: props,
commands: []string{"node"},
versionParam: "--version",
extensions: []string{"*.js", "*.ts", "package.json"},
2020-11-14 11:04:04 -08:00
versionRegex: `(?P<version>[0-9]+.[0-9]+.[0-9]+)`,
}
2020-09-17 07:43:45 -07:00
}
2020-10-01 11:57:02 -07:00
func (n *node) enabled() bool {
2020-11-14 11:04:04 -08:00
return n.language.enabled()
2020-09-17 07:43:45 -07:00
}