mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-13 12:17:26 -08:00
parent
84183b7506
commit
68f576692b
|
@ -149,11 +149,17 @@ func (pt *path) getLetterPath() string {
|
|||
splitted := strings.Split(pwd, pt.env.getPathSeperator())
|
||||
separator := pt.props.getString(FolderSeparatorIcon, pt.env.getPathSeperator())
|
||||
for i := 0; i < len(splitted)-1; i++ {
|
||||
if len(splitted[i]) == 0 {
|
||||
folder := splitted[i]
|
||||
if len(folder) == 0 {
|
||||
continue
|
||||
}
|
||||
letter := []rune(splitted[i])[0]
|
||||
buffer.WriteString(fmt.Sprintf("%c%s", letter, separator))
|
||||
var letter string
|
||||
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])
|
||||
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: "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 {
|
||||
env := new(MockedEnvironment)
|
||||
|
|
Loading…
Reference in a new issue