mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
28 lines
490 B
Go
28 lines
490 B
Go
package main
|
|
|
|
type node struct {
|
|
props *properties
|
|
env environmentInfo
|
|
nodeVersion string
|
|
}
|
|
|
|
func (n *node) string() string {
|
|
return n.nodeVersion
|
|
}
|
|
|
|
func (n *node) init(props *properties, env environmentInfo) {
|
|
n.props = props
|
|
n.env = env
|
|
}
|
|
|
|
func (n *node) enabled() bool {
|
|
if !n.env.hasFiles("*.js") && !n.env.hasFiles("*.ts") {
|
|
return false
|
|
}
|
|
if !n.env.hasCommand("node") {
|
|
return false
|
|
}
|
|
n.nodeVersion = n.env.runCommand("node", "--version")
|
|
return true
|
|
}
|