oh-my-posh/src/segments/php.go

35 lines
777 B
Go
Raw Normal View History

2022-01-26 06:54:36 -08:00
package segments
2021-10-27 01:52:56 -07:00
import (
"oh-my-posh/environment"
"oh-my-posh/properties"
)
2022-01-26 05:10:18 -08:00
type Php struct {
2021-12-03 11:19:57 -08:00
language
2021-10-27 01:52:56 -07:00
}
func (p *Php) Template() string {
return languageTemplate
2021-10-27 01:52:56 -07:00
}
func (p *Php) Init(props properties.Properties, env environment.Environment) {
2022-01-22 10:46:56 -08:00
p.language = language{
2021-10-27 01:52:56 -07:00
env: env,
props: props,
extensions: []string{"*.php", "composer.json", "composer.lock", ".php-version", "blade.php"},
2021-10-27 01:52:56 -07:00
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 }}",
2021-10-27 01:52:56 -07:00
}
}
func (p *Php) Enabled() bool {
return p.language.Enabled()
2021-10-27 01:52:56 -07:00
}