(path string)
| 833 | } |
| 834 | |
| 835 | func 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 | |
| 861 | func determineNextTryBranchName() (string, error) { |
| 862 | branches, err := listGitBranches() |
no outgoing calls
no test coverage detected