1// Package home provides utilities for dealing with the user's home directory.
11var homedir, homedirErr = os.UserHomeDir()
14 if homedirErr != nil {
15 slog.Error("failed to get user home directory", "error", homedirErr)
19// Dir returns the user home directory.
24// Short replaces the actual home path from [Dir] with `~`.
25func Short(p string) string {
26 if homedir == "" || !strings.HasPrefix(p, homedir) {
29 return filepath.Join("~", strings.TrimPrefix(p, homedir))
32// Long replaces the `~` with actual home path from [Dir].
33func Long(p string) string {
34 if homedir == "" || !strings.HasPrefix(p, "~") {
37 return strings.Replace(p, "~", homedir, 1)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list