Source File
getwd.go
Belonging Package
src.elv.sh/pkg/fsutil
package fsutilimport ()var pathSep = string(filepath.Separator)// Getwd returns path of the working directory in a format suitable as the// prompt.func () string {, := os.Getwd()if != nil {return "?"}return TildeAbbr()}// TildeAbbr abbreviates the user's home directory to ~.func ( string) string {, := GetHome("")if == "" || == "/" {// If home is "" or "/", do not abbreviate because (1) it is likely a// problem with the environment and (2) it will make the path actually// longer.return}if == nil {if == {return "~"} else if strings.HasPrefix(, +pathSep) {return "~" + [len():]}}return}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)