2022-01-26 06:54:36 -08:00
|
|
|
package segments
|
2021-10-27 01:52:56 -07:00
|
|
|
|
2022-01-26 04:53:35 -08:00
|
|
|
import (
|
|
|
|
"oh-my-posh/environment"
|
|
|
|
"oh-my-posh/properties"
|
|
|
|
)
|
2022-01-26 01:23:18 -08:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08:00
|
|
|
func (p *Php) Template() string {
|
2022-01-23 12:37:51 -08:00
|
|
|
return languageTemplate
|
2021-10-27 01:52:56 -07:00
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08: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,
|
2021-10-27 05:31:56 -07:00
|
|
|
extensions: []string{"*.php", "composer.json", "composer.lock", ".php-version"},
|
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: "[%[1]s](https://www.php.net/ChangeLog-%[2]s.php#PHP_%[2]s_%[3]s)",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 05:26:56 -08:00
|
|
|
func (p *Php) Enabled() bool {
|
|
|
|
return p.language.Enabled()
|
2021-10-27 01:52:56 -07:00
|
|
|
}
|