oh-my-posh/src/segments/npm.go
lnu 0d9eaa2a09 fix(language): version url templates fix
dotnet + node + npm + php + python
url helper: returns plain text if url is empty instead of failing
2022-03-23 10:35:52 +01:00

35 lines
714 B
Go

package segments
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
type Npm struct {
language
}
func (n *Npm) Enabled() bool {
return n.language.Enabled()
}
func (n *Npm) Template() string {
return " \ue71e {{.Full}} "
}
func (n *Npm) Init(props properties.Properties, env environment.Environment) {
n.language = language{
env: env,
props: props,
extensions: []string{"package.json", "package-lock.json"},
commands: []*cmd{
{
executable: "npm",
args: []string{"--version"},
regex: `(?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
},
},
versionURLTemplate: "https://github.com/npm/cli/releases/tag/v{{ .Full }}",
}
}