Documentation ¶
Index ¶
- func AddRecent(requestedVersion string)
- func CheckDirExist(dir string) bool
- func CheckDirHasTGBin(dir, prefix string) bool
- func CheckFileExist(file string) bool
- func CheckSymlink(symlinkPath string) bool
- func CreateDirIfNotExist(dir string)
- func CreateRecentFile(requestedVersion string)
- func CreateSymlink(cwd string, dir string)
- func DownloadFromURL(installLocation string, url string) (string, error)
- func GetFileName(configfile string) string
- func GetInstalledVersions() ([]string, error)
- func GetRecentVersions() ([]string, error)
- func GetTFLatest(hashiURL string) (string, error)
- func GetTFLatestImplicit(hashiURL string, preRelease bool, version string) (string, error)
- func GetTFList(hashiURL string, listAll bool) ([]string, error)
- func GetTFURLBody(hashiURL string) ([]string, error)
- func Install(tfversion string, binPath string, createSymlink bool)
- func IsDirEmpty(name string) bool
- func Path(value string) string
- func ReadLines(path string) (lines []string, err error)
- func RemoveDuplicateVersions(elements []string) []string
- func RemoveFiles(src string)
- func RemoveSymlink(symlinkPath string)
- func RemoveVersion(tfversion string, binPath string) bool
- func RenameFile(src string, dest string)
- func Unzip(src string, dest string) ([]string, error)
- func ValidMinorVersionFormat(version string) bool
- func ValidVersionFormat(version string) bool
- func VersionExist(val interface{}, array interface{}) (exists bool)
- func WriteLines(lines []string, path string) (err error)
- type Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirExist ¶
CheckDirExist : check if directory exist dir=path to file return path to directory
func CheckDirHasTGBin ¶
CheckDirHasTGBin : // check binary exist (TODO UNIT TEST)
func CheckFileExist ¶
CheckFileExist : check if file exist in directory
func CreateDirIfNotExist ¶
func CreateDirIfNotExist(dir string)
CreateDirIfNotExist : create directory if directory does not exist
func CreateRecentFile ¶
func CreateRecentFile(requestedVersion string)
CreateRecentFile : create a recent file
func DownloadFromURL ¶
DownloadFromURL : Downloads the binary from the source url
func GetFileName ¶
GetFileName : remove file ext. .tfswitch.config returns .tfswitch
func GetInstalledVersions ¶
func GetRecentVersions ¶
GetRecentVersions : get recent version from file
func GetTFLatest ¶
GetTFLatest : Get the latest available terraform version given the hashicorp url
func GetTFLatestImplicit ¶
GetTFLatestImplicit : Get the latest implicit terraform version given the hashicorp url
func GetTFURLBody ¶
GetTFURLBody : Get list of terraform versions from hashicorp releases
func IsDirEmpty ¶
IsDirEmpty : check if directory is empty (TODO UNIT TEST)
func RemoveDuplicateVersions ¶
RemoveDuplicateVersions : remove duplicate version
func RemoveVersion ¶
func Unzip ¶
Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).
func ValidMinorVersionFormat ¶
ValidMinorVersionFormat : returns valid MINOR version format
For example: 0.1 = valid
// For example: a.1.2 = invalid // For example: 0.1.2 = invalid
func ValidVersionFormat ¶
ValidVersionFormat : returns valid version format
For example: 0.1.2 = valid
// For example: 0.1.2-beta1 = valid // For example: 0.1.2-alpha = valid // For example: a.1.2 = invalid // For example: 0.1. 2 = invalid
func VersionExist ¶
func VersionExist(val interface{}, array interface{}) (exists bool)
VersionExist : check if requested version exist
func WriteLines ¶
WriteLines : writes into file