oh-my-posh/src/segments/php.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
777 B
Go

package segments
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
type Php struct {
language
}
func (p *Php) Template() string {
return languageTemplate
}
func (p *Php) Init(props properties.Properties, env environment.Environment) {
p.language = language{
env: env,
props: props,
extensions: []string{"*.php", "composer.json", "composer.lock", ".php-version", "blade.php"},
commands: []*cmd{
{
executable: "php",
args: []string{"--version"},
regex: `(?:PHP (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+))))`,
},
},
versionURLTemplate: "https://www.php.net/ChangeLog-{{ .Major }}.php#PHP_{{ .Major }}_{{ .Minor }}",
}
}
func (p *Php) Enabled() bool {
return p.language.Enabled()
}