mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-23 17:11:08 -08:00
0d9eaa2a09
dotnet + node + npm + php + python url helper: returns plain text if url is empty instead of failing
35 lines
777 B
Go
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()
|
|
}
|