lib

package
v0.0.0-...-312ed20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecent

func AddRecent(requestedVersion string)

AddRecent : add to recent file

func CheckDirExist

func CheckDirExist(dir string) bool

CheckDirExist : check if directory exist dir=path to file return path to directory

func CheckDirHasTGBin

func CheckDirHasTGBin(dir, prefix string) bool

CheckDirHasTGBin : // check binary exist (TODO UNIT TEST)

func CheckFileExist

func CheckFileExist(file string) bool

CheckFileExist : check if file exist in directory

func CheckSymlink(symlinkPath string) bool

CheckSymlink : check file is symlink

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 CreateSymlink(cwd string, dir string)

CreateSymlink : create symlink

func DownloadFromURL

func DownloadFromURL(installLocation string, url string) (string, error)

DownloadFromURL : Downloads the binary from the source url

func GetFileName

func GetFileName(configfile string) string

GetFileName : remove file ext. .tfswitch.config returns .tfswitch

func GetInstalledVersions

func GetInstalledVersions() ([]string, error)

func GetRecentVersions

func GetRecentVersions() ([]string, error)

GetRecentVersions : get recent version from file

func GetTFLatest

func GetTFLatest(hashiURL string) (string, error)

GetTFLatest : Get the latest available terraform version given the hashicorp url

func GetTFLatestImplicit

func GetTFLatestImplicit(hashiURL string, preRelease bool, version string) (string, error)

GetTFLatestImplicit : Get the latest implicit terraform version given the hashicorp url

func GetTFList

func GetTFList(hashiURL string, listAll bool) ([]string, error)

GetTFList : Get the list of available terraform version given the hashicorp url

func GetTFURLBody

func GetTFURLBody(hashiURL string) ([]string, error)

GetTFURLBody : Get list of terraform versions from hashicorp releases

func Install

func Install(tfversion string, binPath string, createSymlink bool)

Install : Install the provided version in the argument

func IsDirEmpty

func IsDirEmpty(name string) bool

IsDirEmpty : check if directory is empty (TODO UNIT TEST)

func Path

func Path(value string) string

Path : returns path of directory value=path to file

func ReadLines

func ReadLines(path string) (lines []string, err error)

ReadLines : Read a whole file into the memory and store it as array of lines

func RemoveDuplicateVersions

func RemoveDuplicateVersions(elements []string) []string

RemoveDuplicateVersions : remove duplicate version

func RemoveFiles

func RemoveFiles(src string)

RemoveFiles : remove file

func RemoveSymlink(symlinkPath string)

RemoveSymlink : remove symlink

func RemoveVersion

func RemoveVersion(tfversion string, binPath string) bool

func RenameFile

func RenameFile(src string, dest string)

RenameFile : rename file name

func Unzip

func Unzip(src string, dest string) ([]string, error)

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

func ValidMinorVersionFormat(version string) bool

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

func ValidVersionFormat(version string) bool

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

func WriteLines(lines []string, path string) (err error)

WriteLines : writes into file

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command : type string

func NewCommand

func NewCommand(name string) *Command

NewCommand : get command

func (*Command) Find

func (cmd *Command) Find() func() string

Find : find all bin path

func (*Command) PathList

func (cmd *Command) PathList() []string

PathList : get bin path list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL