Documentation
¶
Index ¶
- Constants
- func CreateFile(filePath string) (*os.File, error)
- func DetectGitDefaultBranch(url string) string
- func Expand(input string) string
- func ExpandPath(input string) string
- func FileExists(path string) bool
- func GetHomeDir() string
- func LatestGitHubPreRelease(repo string) string
- func LatestGitHubRelease(repo string) string
- func ReadLine(reader *bufio.Reader, prompt string) string
- func ReadYesNo(reader *bufio.Reader, prompt string) bool
- func SplitInput(input string) []string
- func ValidateFileName(name string) error
- func Yellow(s string) string
- type Platform
Constants ¶
const Sep = string(os.PathSeparator)
Sep is the OS path separator as a string.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
CreateFile opens or creates the file at filePath for reading and writing, creating parent directories as needed.
func DetectGitDefaultBranch ¶
DetectGitDefaultBranch queries the remote at url to find its default branch without cloning. Returns an empty string if the remote is unreachable or the branch cannot be determined.
func Expand ¶
Expand expands environment variables in input without tokenizing, preserving quoting and spacing. Use ExpandPath for file system paths that also need ~ expansion.
func ExpandPath ¶
ExpandPath expands environment variables and a leading ~ in the given path.
func FileExists ¶
FileExists reports whether the file or directory at path exists. Permission errors are treated as the path existing to avoid silently overwriting or recreating inaccessible files.
func GetHomeDir ¶
func GetHomeDir() string
GetHomeDir returns the current user's home directory, fatally logging on failure.
func LatestGitHubPreRelease ¶
LatestGitHubPreRelease returns the latest pre-release version for the given repo. Returns an empty string if none is found or the request fails.
func LatestGitHubRelease ¶
LatestGitHubRelease queries the GitHub releases API for the given repo (e.g. "owner/repo") and returns the latest stable version without the leading "v". Returns an empty string if the request fails, times out, or no release exists.
func ReadYesNo ¶
ReadYesNo prompts the user and returns true if they answer "y" or "yes" (case-insensitive).
func SplitInput ¶
SplitInput splits a command string into tokens, respecting double-quoted segments. todo: replace with a proper shell-quoting parser
func ValidateFileName ¶
ValidateFileName reports whether name is safe to use as a filename across common operating systems. It rejects empty names, path separators, shell special characters, control characters, and names composed only of dots or spaces.