mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-05 16:27: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() {
|
func (pt *Path) setStyle() {
|
||||||
if len(pt.relative) == 0 {
|
if len(pt.relative) == 0 {
|
||||||
pt.Path = pt.root
|
pt.Path = pt.root
|
||||||
|
if strings.HasSuffix(pt.Path, ":") {
|
||||||
|
pt.Path += pt.env.PathSeparator()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch style := pt.props.GetString(properties.Style, Agnoster); style {
|
switch style := pt.props.GetString(properties.Style, Agnoster); style {
|
||||||
|
|
|
@ -294,7 +294,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Style: Letter,
|
Style: Letter,
|
||||||
Expected: "C:",
|
Expected: "C:\\",
|
||||||
HomePath: homeDirWindows,
|
HomePath: homeDirWindows,
|
||||||
Pwd: "C:\\",
|
Pwd: "C:\\",
|
||||||
GOOS: environment.WINDOWS,
|
GOOS: environment.WINDOWS,
|
||||||
|
@ -563,7 +563,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Style: AgnosterShort,
|
Style: AgnosterShort,
|
||||||
Expected: "C:",
|
Expected: "C:/",
|
||||||
HomePath: homeDir,
|
HomePath: homeDir,
|
||||||
Pwd: "/mnt/c",
|
Pwd: "/mnt/c",
|
||||||
Pswd: "C:",
|
Pswd: "C:",
|
||||||
|
@ -594,7 +594,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Style: AgnosterShort,
|
Style: AgnosterShort,
|
||||||
Expected: "C:",
|
Expected: "C:\\",
|
||||||
HomePath: homeDirWindows,
|
HomePath: homeDirWindows,
|
||||||
Pwd: "C:",
|
Pwd: "C:",
|
||||||
GOOS: environment.WINDOWS,
|
GOOS: environment.WINDOWS,
|
||||||
|
@ -743,7 +743,7 @@ func TestFullAndFolderPath(t *testing.T) {
|
||||||
{Style: Folder, FolderSeparatorIcon: "|", Pwd: "/a/b/c/d", Expected: "d"},
|
{Style: Folder, FolderSeparatorIcon: "|", Pwd: "/a/b/c/d", Expected: "d"},
|
||||||
|
|
||||||
// for Windows paths
|
// 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: Folder, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||||
{Style: Full, 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},
|
{Style: Full, FolderSeparatorIcon: "\\", Pwd: homeDirWindows + "\\abc", Expected: "~\\abc", PathSeparator: "\\", GOOS: environment.WINDOWS},
|
||||||
|
|
Loading…
Reference in a new issue