Documentation
¶
Index ¶
- func AddRecent(requestedVersion string)
- func ChangeSymlink(binVersionPath string, binPath string)
- func CheckDirExist(dir string) bool
- func CheckDirHasTGBin(dir, prefix string) bool
- func CheckDirWritable(dir string) bool
- func CheckFileExist(file string) bool
- func CheckSymlink(symlinkPath string) bool
- func ConvertExecutableExt(fpath string) string
- func CreateDirIfNotExist(dir string)
- func CreateRecentFile(requestedVersion string)
- func CreateSymlink(cwd string, dir string)
- func DownloadFromURL(installLocation string, url string) (string, error)
- func GetCurrentDirectory() string
- func GetFileName(configfile string) string
- func GetHomeDirectory() string
- func GetInstallLocation() string
- func GetRecentVersions() ([]string, error)
- func GetSemver(tfconstraint *string, mirrorURL *string) (string, error)
- func GetTFLatest(mirrorURL string) (string, error)
- func GetTFLatestImplicit(mirrorURL string, preRelease bool, version string) (string, error)
- func GetTFList(mirrorURL string, preRelease bool) ([]string, error)
- func GetTFURLBody(mirrorURL string) ([]string, error)
- func Install(tfversion string, binPath string, mirrorURL string)
- func InstallableBinLocation(userBinPath string) string
- func IsDirEmpty(name string) bool
- func Path(value string) string
- func PrintInvalidMinorTFVersion()
- func PrintInvalidTFVersion()
- func ReadLines(path string) (lines []string, err error)
- func RemoveDuplicateVersions(elements []string) []string
- func RemoveFiles(src string)
- func RemoveSymlink(symlinkPath string)
- func RenameFile(src string, dest string)
- func SemVerParser(tfconstraint *string, tflist []string) (string, error)
- 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 AddRecent ¶ added in v0.13.1
func AddRecent(requestedVersion string)
AddRecent : add to recent file
func ChangeSymlink ¶ added in v0.13.1
ChangeSymlink : move symlink to existing binary
func CheckDirExist ¶ added in v0.13.1
CheckDirExist : check if directory exist dir=path to file return bool
func CheckDirHasTGBin ¶ added in v0.13.1
CheckDirHasTGBin : // check binary exist (TODO UNIT TEST)
func CheckDirWritable ¶ added in v0.13.1
Check if user has permission to directory : dir=path to file return bool
func CheckFileExist ¶
CheckFileExist : check if file exist in directory
func CheckSymlink ¶ added in v0.13.1
CheckSymlink : check file is symlink
func ConvertExecutableExt ¶ added in v0.13.1
ConvertExecutableExt : convert excutable with local OS extension
func CreateDirIfNotExist ¶
func CreateDirIfNotExist(dir string)
CreateDirIfNotExist : create directory if directory does not exist
func CreateRecentFile ¶ added in v0.13.1
func CreateRecentFile(requestedVersion string)
CreateRecentFile : create a recent file
func DownloadFromURL ¶
DownloadFromURL : Downloads the binary from the source url
func GetCurrentDirectory ¶ added in v0.13.1
func GetCurrentDirectory() string
GetCurrentDirectory : return the current directory
func GetFileName ¶ added in v0.13.1
GetFileName : remove file ext. .tfswitch.config returns .tfswitch
func GetHomeDirectory ¶ added in v0.13.1
func GetHomeDirectory() string
GetHomeDirectory : return the home directory
func GetInstallLocation ¶ added in v0.13.1
func GetInstallLocation() string
GetInstallLocation : get location where the terraform binary will be installed, will create a directory in the home location if it does not exist
func GetRecentVersions ¶ added in v0.13.1
GetRecentVersions : get recent version from file
func GetSemver ¶ added in v0.13.1
GetSemver : returns version that will be installed based on server constaint provided
func GetTFLatest ¶ added in v0.13.1
GetTFLatest : Get the latest terraform version given the hashicorp url
func GetTFLatestImplicit ¶ added in v0.13.1
GetTFLatestImplicit : Get the latest implicit terraform version given the hashicorp url
func GetTFList ¶ added in v0.13.1
GetTFList : Get the list of available terraform version given the hashicorp url
func GetTFURLBody ¶ added in v0.13.1
GetTFURLBody : Get list of terraform versions from hashicorp releases
func InstallableBinLocation ¶ added in v0.13.1
InstallableBinLocation : Checks if terraform is installable in the location provided by the user. If not, create $HOME/bin. Ask users to add $HOME/bin to $PATH and return $HOME/bin as install location
func IsDirEmpty ¶ added in v0.13.1
IsDirEmpty : check if directory is empty (TODO UNIT TEST)
func PrintInvalidMinorTFVersion ¶ added in v0.13.1
func PrintInvalidMinorTFVersion()
Print invalid TF version
func ReadLines ¶ added in v0.13.1
ReadLines : Read a whole file into the memory and store it as array of lines
func RemoveDuplicateVersions ¶ added in v0.13.1
RemoveDuplicateVersions : remove duplicate version
func SemVerParser ¶ added in v0.13.1
ValidateSemVer : Goes through the list of terraform version, return a valid tf version for contraint provided
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 ¶ added in v0.13.1
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 ¶ added in v0.13.1
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 ¶ added in v0.13.1
func VersionExist(val interface{}, array interface{}) (exists bool)
VersionExist : check if requested version exist
func WriteLines ¶ added in v0.13.1
WriteLines : writes into file