mirror of https://github.com/Hilbis/Hilbish
fix: substitution of home dir to ~ when names in path match it
fixes edge cases like `/mnt/home/user`dev
parent
4a517bde5e
commit
effd028658
4
main.go
4
main.go
|
@ -230,7 +230,9 @@ func fmtPrompt() string {
|
||||||
host, _ := os.Hostname()
|
host, _ := os.Hostname()
|
||||||
cwd, _ := os.Getwd()
|
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
|
username := curuser.Username
|
||||||
// this will be baked into binary since GOOS is a constant
|
// this will be baked into binary since GOOS is a constant
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
|
|
Loading…
Reference in New Issue