util

package
v0.4.0-rc Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 31 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bold = color.New(color.Bold).SprintFunc()
View Source
var CyanBold = color.New(color.FgCyan).Add(color.Bold).SprintFunc()
View Source
var Faint = color.New(color.Faint).SprintFunc()
View Source
var Green = color.New(color.FgGreen).SprintfFunc()
View Source
var GreenBold = color.New(color.FgGreen).Add(color.Bold).SprintFunc()
View Source
var Red = color.New(color.FgRed).Add(color.Bold).SprintFunc()
View Source
var YellowBold = color.New(color.FgYellow).Add(color.Bold).SprintFunc()

Functions

func BallerinaInstallationDir added in v0.2.1

func BallerinaInstallationDir() string

func CelleryInstallationDir added in v0.2.0

func CelleryInstallationDir() string

func CleanAndCreateDir added in v0.4.0

func CleanAndCreateDir(dirPath string) error

func CleanOrCreateDir

func CleanOrCreateDir(dirPath string) error

func ContainsInStringArray added in v0.2.0

func ContainsInStringArray(array []string, item string) bool

func ConvertStringToTime

func ConvertStringToTime(timeString string) time.Time

func ConvertToAlphanumeric added in v0.4.0

func ConvertToAlphanumeric(input, replacement string) string

func CopyDir

func CopyDir(src string, dst string) error

Dir copies a whole directory recursively

func CopyFile

func CopyFile(src, dst string) error

File copies a single file from src to dst

func CopyK8sArtifacts added in v0.4.0

func CopyK8sArtifacts(outPath string)

func CreateDir

func CreateDir(dirPath string) error

func CreateTempExecutableBalFile added in v0.3.0

func CreateTempExecutableBalFile(file string, action string) (string, error)

func DownloadFromS3Bucket

func DownloadFromS3Bucket(bucket, item, path string, displayProgressBar bool)

func ExecuteCommand

func ExecuteCommand(cmd *exec.Cmd) error

func ExitWithErrorMessage

func ExitWithErrorMessage(message string, err error)

ExitWithErrorMessage prints an error message and exits the command

func ExtractTarGzFile

func ExtractTarGzFile(extractTo, archive_name string) error

func FileExists

func FileExists(path string) (bool, error)

func FindInDirectory

func FindInDirectory(directory, suffix string) []string

func FormatBytesToString added in v0.2.0

func FormatBytesToString(size int64) string

func GetCurrentPath added in v0.2.0

func GetCurrentPath() (string, error)

func GetDuration

func GetDuration(startTime time.Time) string

func GetFileSize

func GetFileSize(path string) (int64, error)

func GetS3ObjectEtag added in v0.4.0

func GetS3ObjectEtag(bucket, item string) string

func GetS3ObjectSize added in v0.2.0

func GetS3ObjectSize(bucket, item string) int64

func GetSourceFileName

func GetSourceFileName(filePath string) (string, error)

func GetSubDirectoryNames

func GetSubDirectoryNames(path string) ([]string, error)

func GetYesOrNoFromUser added in v0.2.0

func GetYesOrNoFromUser(question string, withBackOption bool) (bool, bool, error)

func IsCommandAvailable added in v0.2.1

func IsCommandAvailable(name string) bool

func IsCompleteSetupSelected added in v0.2.0

func IsCompleteSetupSelected() (bool, bool)

func IsLoadBalancerIngressTypeSelected added in v0.2.0

func IsLoadBalancerIngressTypeSelected() (bool, bool)

func MergeKubeConfig added in v0.2.0

func MergeKubeConfig(newConfigFile string) error

func OpenBrowser added in v0.2.0

func OpenBrowser(url string) error

OpenBrowser opens up the provided URL in a browser

func PrintSuccessMessage

func PrintSuccessMessage(message string)

PrintSuccessMessage prints the standard command success message

func PrintWarningMessage added in v0.3.0

func PrintWarningMessage(message string)

func PrintWhatsNextMessage

func PrintWhatsNextMessage(action string, cmd string)

func RecursiveZip

func RecursiveZip(files []string, folders []string, destinationPath string) error

func RemoveDir added in v0.4.0

func RemoveDir(dirPath string) error

func RenameFile

func RenameFile(oldName, newName string) error

func ReplaceInFile

func ReplaceInFile(srcFile, oldString, newString string, replaceCount int) error

func ReplaceInstanceName

func ReplaceInstanceName(srcFile, oldString, newString string) error

func RequestCredentials

func RequestCredentials(credentialType string, usernameOverride string) (string, string, error)

RequestCredentials requests the credentials form the user and returns them

func TestMethodExists added in v0.3.0

func TestMethodExists(sourceFile string) (bool, error)

TestMethodExists checks if the test method exists in ballerina file

func Unzip

func Unzip(zipFolderName string, destinationFolderName string) error

func UserHomeCelleryDir added in v0.4.0

func UserHomeCelleryDir() string

func UserHomeDir

func UserHomeDir() string

Types

type BLangManager added in v0.2.0

type BLangManager struct{}

func (*BLangManager) GetExecutablePath added in v0.2.0

func (langMgr *BLangManager) GetExecutablePath() (string, error)

func (*BLangManager) Init added in v0.2.0

func (langMgr *BLangManager) Init() error

type Gcp

type Gcp struct {
	Compute GcpCompute `json:"compute"`
	Core    GcpCore    `json:"core"`
}

type GcpCompute

type GcpCompute struct {
	Region string `json:"region"`
	Zone   string `json:"zone"`
}

type GcpCore

type GcpCore struct {
	Account string `json:"account"`
	Project string `json:"project"`
}

type LangManager added in v0.2.0

type LangManager interface {
	Init() error
	GetExecutablePath() (string, error)
}

type RegistryCredentials added in v0.2.0

type RegistryCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Spinner

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

func StartNewSpinner

func StartNewSpinner(action string) *Spinner

StartNewSpinner starts a new spinner with the provided message

func (*Spinner) Pause added in v0.2.0

func (s *Spinner) Pause()

Pause the spinner and clear the line

func (*Spinner) Resume added in v0.2.0

func (s *Spinner) Resume()

Resume the previous action

func (*Spinner) SetNewAction

func (s *Spinner) SetNewAction(action string)

SetNewAction sets the current action of a spinner

func (*Spinner) Stop

func (s *Spinner) Stop(isSuccess bool)

Stop causes the spinner to stop

Jump to

Keyboard shortcuts

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