Documentation
¶
Index ¶
- func AcquireInstallLock() func()
- func AddRecent(version, installPath string)
- func CheckSymlink(path string) bool
- func ConvertExecutableExt(path string) string
- func CreateDirIfNotExist(path string)
- func CreateSymlink(src, dest string)
- func DirExists(path string) bool
- func FileExists(path string) bool
- func GetCurrentDirectory() string
- func GetHomeDirectory() string
- func GetInstallLocation() string
- func GetInstallLocationWithBase(installPath string) string
- func GetRecentVersions() ([]string, error)
- func GetRecentVersionsFrom(installPath string) ([]string, error)
- func GetVersionList(includePrerelease bool) ([]string, error)
- func GetVersionListFromURL(url string, includePrerelease bool) ([]string, error)
- func Install(version, binPath string) string
- func InstallWithOptions(version string, options InstallOptions) string
- func InstallableBinLocation(userBinPath string) string
- func IsDirWritable(path string) bool
- func IsInPath(dir string) bool
- func LatestMatchingVersion(list []string, requested string) (string, error)
- func LatestVersion(list []string) (string, error)
- func Path(p string) string
- func ReadLines(path string) ([]string, error)
- func RemoveFile(path string)
- func RemoveSymlink(path string)
- func RenameFile(src, dest string)
- func RetrieveFileContents(path string) string
- func ValidVersionFormat(version string) bool
- func VersionExist(version string, list []string) bool
- func WriteLines(lines []string, path string)
- type InstallOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireInstallLock ¶ added in v0.1.4
func AcquireInstallLock() func()
AcquireInstallLock creates an exclusive lock file to prevent concurrent installations. Returns a release function that removes the lock.
func AddRecent ¶
func AddRecent(version, installPath string)
AddRecent adds version to the RECENT file (capped at maxRecentVersions).
func CheckSymlink ¶
CheckSymlink returns true if the given path is a symlink.
func ConvertExecutableExt ¶
ConvertExecutableExt appends ".exe" on Windows if not already present.
func CreateDirIfNotExist ¶
func CreateDirIfNotExist(path string)
CreateDirIfNotExist creates a directory (and all parents) if it does not exist.
func CreateSymlink ¶
func CreateSymlink(src, dest string)
CreateSymlink creates a symlink from src to dest using absolute paths.
func FileExists ¶
FileExists returns true if a file exists at the given path.
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
GetCurrentDirectory returns the current working directory.
func GetHomeDirectory ¶
func GetHomeDirectory() string
GetHomeDirectory returns the current user's home directory.
func GetInstallLocation ¶
func GetInstallLocation() string
GetInstallLocation returns (and creates if necessary) the directory where versioned terramate binaries are stored (~/.terramate.versions/).
func GetInstallLocationWithBase ¶
GetInstallLocationWithBase returns the directory where versioned terramate binaries are stored, rooted at installPath or the user's home when empty.
func GetRecentVersions ¶
GetRecentVersions returns the recently used versions with a " *recent" suffix.
func GetRecentVersionsFrom ¶
GetRecentVersionsFrom returns recently used versions from a custom install base.
func GetVersionList ¶
GetVersionList fetches the list of available terramate versions from the GitHub Releases API and returns them sorted newest-first. Set includePrerelease to true to also include pre-release / RC versions.
func GetVersionListFromURL ¶
GetVersionListFromURL fetches versions from a custom releases API URL.
func Install ¶
Install downloads (if necessary) and activates the requested version. It returns the path to the active symlink.
func InstallWithOptions ¶
func InstallWithOptions(version string, options InstallOptions) string
InstallWithOptions downloads (if necessary) and activates the requested version.
func InstallableBinLocation ¶
InstallableBinLocation returns the effective install path for the terramate binary symlink. It tries each candidate in order, falling back to ~/bin (creating it if necessary) when the primary location is not writable.
func IsDirWritable ¶
IsDirWritable returns true if the given directory is writable.
func IsInPath ¶ added in v0.1.4
IsInPath reports whether dir is present in the current PATH environment.
func LatestMatchingVersion ¶
LatestMatchingVersion returns the newest version matching a prefix or exact version.
func LatestVersion ¶
LatestVersion returns the newest version from the provided list.
func RemoveSymlink ¶
func RemoveSymlink(path string)
RemoveSymlink removes the symlink at the given path.
func RetrieveFileContents ¶
RetrieveFileContents reads the first non-empty line from a file.
func ValidVersionFormat ¶
ValidVersionFormat returns true if the given string looks like a valid semver.
func VersionExist ¶
VersionExist returns true if the given version is present in the list.
func WriteLines ¶
WriteLines writes a slice of strings to a file, one per line.