2
2
kopia lustrzana https://github.com/Hilbis/Hilbish synced 2025-07-13 06:12:03 +00:00

fix: substitution of home dir to ~ when names in path match it

fixes edge cases like `/mnt/home/user`
This commit is contained in:
TorchedSammy 2021-12-01 18:30:03 -04:00
rodzic 4a517bde5e
commit effd028658
Podpisane przez: sammyette
ID klucza GPG: 904FC49417B44DCD

Wyświetl plik

@ -230,7 +230,9 @@ func fmtPrompt() string {
host, _ := os.Hostname()
cwd, _ := os.Getwd()
cwd = strings.Replace(cwd, curuser.HomeDir, "~", 1)
if strings.HasPrefix(cwd, curuser.HomeDir) {
cwd = "~" + strings.TrimPrefix(cwd, curuser.HomeDir)
}
username := curuser.Username
// this will be baked into binary since GOOS is a constant
if runtime.GOOS == "windows" {