New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Azure functions' segment gets wrapped to next line #1108
Comments
Interesting. Maybe there's a line break in the output. |
@JatinSanghvi I can't reproduce this, can I get the full theme config? |
@JanDeDobbeleer - Here's the complete config: {
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "azfunc",
"style": "plain",
"foreground": "black",
"background": "white",
"properties": {
"display_version": true
}
}
]
}
],
"final_space": true
} I also installed Azure Functions Core Tools on Ubuntu 18.04 WSL, and set the same config for bash shell. Did not find any problem there. |
Here's a short Go program I came up with that should give the clue. package main
import (
"fmt"
"regexp"
)
func main() {
ver := parse(`(?P<version>.+)`, "3.0.3785\x0d\x0a")
fmt.Println("Windows PowerShell: Azure Functions version segment", []byte(ver.full))
ver = parse(`(?:(?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?:\d{2})(?P<patch>[0-9]{1}))))`, "5.0.402\x0d\x0a")
fmt.Println("Windows PowerShell: .NET version segment ", []byte(ver.full))
ver = parse(`(?P<version>.+)`, "3.0.3785\x0a")
fmt.Println("Ubuntu Bash: Azure Functions version segment", []byte(ver.full))
}
type version struct {
full, major, minor, patch string
}
func parse(regex, versionInfo string) version {
values := findNamedRegexMatch(regex, versionInfo)
return version{values["version"], values["major"], values["minor"], values["patch"]}
}
func findNamedRegexMatch(pattern, text string) map[string]string {
re := regexp.MustCompile(pattern)
match := re.FindStringSubmatch(text)
result := make(map[string]string)
for i, name := range re.SubexpNames() {
if i == 0 {
continue
}
result[name] = match[i]
}
return result
} Output
Note that only the version of Azure Functions on Windows has carriage return (ASCII code 13 in decimal) added to the end. Updating the value of |
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. |
Code of Conduct
What happened?
I have set
display_version
property value totrue
inazfunc
segment. That makes the prompt wrap to next line for some reason.Segment
PowerShell
Version
5.12.1
Theme
Custom Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Relevant log output
No response
The text was updated successfully, but these errors were encountered: