MCPcopy Index your code
hub / github.com/nikivdev/go / expandUserPath

Function expandUserPath

main.go:835–859  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

833}
834
835func expandUserPath(path string) (string, error) {
836 path = strings.TrimSpace(path)
837 if path == "" {
838 return "", fmt.Errorf("path cannot be empty")
839 }
840 if path[0] != '~' {
841 return path, nil
842 }
843
844 home, err := os.UserHomeDir()
845 if err != nil {
846 return "", fmt.Errorf("determine home directory: %w", err)
847 }
848
849 if len(path) == 1 {
850 return home, nil
851 }
852
853 switch path[1] {
854 case '/', '\\':
855 return filepath.Join(home, path[2:]), nil
856 default:
857 return "", fmt.Errorf("unsupported ~ expansion in %q", path)
858 }
859}
860
861func determineNextTryBranchName() (string, error) {
862 branches, err := listGitBranches()

Callers 5

normalizeWorkspacePathFunction · 0.70
resolveWorkspaceFilePathFunction · 0.70
resolveTaskfilePathFunction · 0.70
mainFunction · 0.70
promptCustomSymlinkPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected