2
3
의 미러 https://github.com/sammy-ette/Hilbish synced 2025-08-10 02:52: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
부모 4a517bde5e
커밋 effd028658
로그인 계정: sammyette
GPG 키 ID: 904FC49417B44DCD

파일 보기

@ -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" {