util

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

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 CreateCelleryDirStructure added in v0.4.0

func CreateCelleryDirStructure()

func CreateDir

func CreateDir(dirPath string) error

func CreateTempExecutableBalFile added in v0.3.0

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

func CreateTempMainBalFile added in v0.6.0

func CreateTempMainBalFile(moduleDir string) error

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 FileExists

func FileExists(path string) (bool, error)

func FindInDirectory

func FindInDirectory(directory, suffix string) []string

Return a list of files having its name matching the given pattern

func FindPatternInFile added in v0.6.0

func FindPatternInFile(searchString string, filePath string) (bool, error)

func FindRecursiveInDirectory added in v0.6.0

func FindRecursiveInDirectory(root, pattern string) ([]string, error)

Return a list of files having its name matching the given pattern

func GetDuration

func GetDuration(startTime time.Time) string

func GetFileSize

func GetFileSize(path string) (int64, error)

func GetSourceName added in v0.6.0

func GetSourceName(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 OpenBrowser added in v0.2.0

func OpenBrowser(url string) error

OpenBrowser opens up the provided URL in a browser

func PrintInfoMessage added in v0.4.0

func PrintInfoMessage(message string)

PrintInfoMessage prints an information

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 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 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