oh-my-posh/src/segment_node.go

30 lines
682 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{
2021-02-03 10:11:32 -08:00
env: env,
props: props,
extensions: []string{"*.js", "*.ts", "package.json"},
commands: []*cmd{
{
executable: "node",
args: []string{"--version"},
regex: `(?:v(?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+))))`,
},
},
2021-02-03 10:11:32 -08:00
versionURLTemplate: "[%[1]s](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V%[2]s.md#%[1]s)",
2020-11-14 11:04:04 -08:00
}
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
}