mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-14 20:58:12 -08:00
parent
84183b7506
commit
68f576692b
|
@ -149,11 +149,17 @@ func (pt *path) getLetterPath() string {
|
||||||
splitted := strings.Split(pwd, pt.env.getPathSeperator())
|
splitted := strings.Split(pwd, pt.env.getPathSeperator())
|
||||||
separator := pt.props.getString(FolderSeparatorIcon, pt.env.getPathSeperator())
|
separator := pt.props.getString(FolderSeparatorIcon, pt.env.getPathSeperator())
|
||||||
for i := 0; i < len(splitted)-1; i++ {
|
for i := 0; i < len(splitted)-1; i++ {
|
||||||
if len(splitted[i]) == 0 {
|
folder := splitted[i]
|
||||||
|
if len(folder) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
letter := []rune(splitted[i])[0]
|
var letter string
|
||||||
buffer.WriteString(fmt.Sprintf("%c%s", letter, separator))
|
if strings.HasPrefix(folder, ".") && len(folder) > 1 {
|
||||||
|
letter = folder[0:2]
|
||||||
|
} else {
|
||||||
|
letter = folder[0:1]
|
||||||
|
}
|
||||||
|
buffer.WriteString(fmt.Sprintf("%s%s", letter, separator))
|
||||||
}
|
}
|
||||||
buffer.WriteString(splitted[len(splitted)-1])
|
buffer.WriteString(splitted[len(splitted)-1])
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
|
|
|
@ -299,6 +299,8 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
|
|
||||||
{Style: Letter, Expected: "~ > a > w > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "~ > a > w > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/burp/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/burp/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
||||||
|
{Style: Letter, Expected: "u > .b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
||||||
|
{Style: Letter, Expected: "u > .b > a > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(MockedEnvironment)
|
env := new(MockedEnvironment)
|
||||||
|
|
Loading…
Reference in a new issue