lib

package
v0.0.0-...-6150678 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 20 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 ChangeSymlink(binVersionPath string, binPath string)

ChangeSymlink : move symlink to existing binary

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 CheckDirWritable

func CheckDirWritable(dir string) bool

Check if user has permission to directory : dir=path to file return bool

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 ConvertExecutableExt

func ConvertExecutableExt(fpath string) string

ConvertExecutableExt : convert excutable with local OS extension

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 CreateSymlink : create symlink

func DownloadFromURL

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

DownloadFromURL : Downloads the binary from the source url

func FileExists

func FileExists(filename string) bool

FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func GetAppList

func GetAppList(gruntURLPage string) []string

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetFileName

func GetFileName(configfile string) string

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

func GetHomeDirectory

func GetHomeDirectory() string

GetHomeDirectory : return the home directory

func GetInstallLocation

func GetInstallLocation() string

GetInstallLocation : get location where the terragrunt binary will be installed, will create a directory in the home location if it does not exist

func GetRecentVersions

func GetRecentVersions() ([]string, error)

GetRecentVersions : get recent version from file

func GetSemver

func GetSemver(tgconstraint *string, proxyUrl string) (string, error)

GetSemver : returns version that will be installed based on server constaint provided

func Install

func Install(tgversion string, usrBinPath string, mirrorURL string) string

Install : Install the provided version in the argument

func InstallableBinLocation

func InstallableBinLocation(userBinPath string) string

InstallableBinLocation : Checks if terragrunt is installable in the location provided by the user. If not, create $HOME/bin. Ask users to add $HOME/bin to $PATH Return $HOME/bin as install location

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 PrintCreateDirStmt

func PrintCreateDirStmt(unableDir string, writable string)

func PrintInvalidTFVersion

func PrintInvalidTFVersion()

Print invalid TF version

func PrintInvalidTGVersion

func PrintInvalidTGVersion()

Print invalid TG version

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 ReadingFileMsg

func ReadingFileMsg(filename string)

Print message reading file content of :

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 RenameFile

func RenameFile(src string, dest string)

RenameFile : rename file name

func RetrieveFileContents

func RetrieveFileContents(file string) string

retrive file content of regular file

func SemVerParser

func SemVerParser(tfconstraint *string, tflist []string) (string, error)

ValidateSemVer : Goes through the list of terragrunt version, return a valid tf version for contraint provided

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

type ListVersion

type ListVersion struct {
	Versions []string `json:"Versions"`
}

Jump to

Keyboard shortcuts

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