mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 13:57:26 -08:00
parent
48d1015c3e
commit
016dc50e72
|
@ -127,6 +127,9 @@ func (pt *Path) Init(props properties.Properties, env environment.Environment) {
|
|||
func (pt *Path) setStyle() {
|
||||
if len(pt.relative) == 0 {
|
||||
pt.Path = pt.root
|
||||
if strings.HasSuffix(pt.Path, ":") {
|
||||
pt.Path += pt.env.PathSeparator()
|
||||
}
|
||||
return
|
||||
}
|
||||
switch style := pt.props.GetString(properties.Style, Agnoster); style {
|
||||
|
|
|
@ -294,7 +294,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Style: Letter,
|
||||
Expected: "C:",
|
||||
Expected: "C:\\",
|
||||
HomePath: homeDirWindows,
|
||||
Pwd: "C:\\",
|
||||
GOOS: environment.WINDOWS,
|
||||
|
@ -563,7 +563,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Style: AgnosterShort,
|
||||
Expected: "C:",
|
||||
Expected: "C:/",
|
||||
HomePath: homeDir,
|
||||
Pwd: "/mnt/c",
|
||||
Pswd: "C:",
|
||||
|
@ -594,7 +594,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Style: AgnosterShort,
|
||||
Expected: "C:",
|
||||
Expected: "C:\\",
|
||||
HomePath: homeDirWindows,
|
||||
Pwd: "C:",
|
||||
GOOS: environment.WINDOWS,
|
||||
|
@ -743,7 +743,7 @@ func TestFullAndFolderPath(t *testing.T) {
|
|||
{Style: Folder, FolderSeparatorIcon: "|", Pwd: "/a/b/c/d", Expected: "d"},
|
||||
|
||||
// for Windows paths
|
||||
{Style: Folder, FolderSeparatorIcon: "\\", Pwd: "C:\\", Expected: "C:", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||
{Style: Folder, FolderSeparatorIcon: "\\", Pwd: "C:\\", Expected: "C:\\", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||
{Style: Folder, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||
{Style: Full, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||
{Style: Full, FolderSeparatorIcon: "\\", Pwd: homeDirWindows + "\\abc", Expected: "~\\abc", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||
|
|
Loading…
Reference in a new issue