utils

package
v3.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

19 types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContentToEachLineInFile

func AddContentToEachLineInFile(filePath string, predicate func(string) string) error

func AddContentToFile

func AddContentToFile(filePath, valueToAdd string, positon string) error

func CDToAngularApp

func CDToAngularApp()

func CDToFirebaseApp

func CDToFirebaseApp()

func CDToFlaskApp

func CDToFlaskApp()

func CDToFlutterApp

func CDToFlutterApp()

func CDToLocation

func CDToLocation(location string)

func CDToTestNGApp

func CDToTestNGApp()

func CDToWorkspaceRoot

func CDToWorkspaceRoot()

func ClearScreen

func ClearScreen()

Function to clear the console screen

func ConvertPathToOSFormat

func ConvertPathToOSFormat(inputPath string) string

func ConvertToBoolArray

func ConvertToBoolArray(input []interface{}) []bool

func ConvertToByteArray

func ConvertToByteArray(input []interface{}) []byte

func ConvertToComplex128Array

func ConvertToComplex128Array(input []interface{}) []complex128

func ConvertToComplex64Array

func ConvertToComplex64Array(input []interface{}) []complex64

func ConvertToFloat32Array

func ConvertToFloat32Array(input []interface{}) []float32

func ConvertToFloat64Array

func ConvertToFloat64Array(input []interface{}) []float64

func ConvertToInt16Array

func ConvertToInt16Array(input []interface{}) []int16

func ConvertToInt32Array

func ConvertToInt32Array(input []interface{}) []int32

func ConvertToInt64Array

func ConvertToInt64Array(input []interface{}) []int64

func ConvertToInt8Array

func ConvertToInt8Array(input []interface{}) []int8

func ConvertToIntArray

func ConvertToIntArray(input []interface{}) []int

func ConvertToInterfaceArray

func ConvertToInterfaceArray[T any](input []T) []interface{}

func ConvertToRuneArray

func ConvertToRuneArray(input []interface{}) []rune

func ConvertToStringArray

func ConvertToStringArray(input []interface{}) []string

func ConvertToStringBoolMap

func ConvertToStringBoolMap(originalMap map[string]interface{}) map[string]bool

func ConvertToStringComplex128Map

func ConvertToStringComplex128Map(originalMap map[string]interface{}) map[string]complex128

func ConvertToStringComplex64Map

func ConvertToStringComplex64Map(originalMap map[string]interface{}) map[string]complex64

func ConvertToStringErrorMap

func ConvertToStringErrorMap(originalMap map[string]interface{}) map[string]error

func ConvertToStringFloat32Map

func ConvertToStringFloat32Map(originalMap map[string]interface{}) map[string]float32

func ConvertToStringFloat64Map

func ConvertToStringFloat64Map(originalMap map[string]interface{}) map[string]float64

func ConvertToStringInt16Map

func ConvertToStringInt16Map(originalMap map[string]interface{}) map[string]int16

func ConvertToStringInt32Map

func ConvertToStringInt32Map(originalMap map[string]interface{}) map[string]int32

func ConvertToStringInt64Map

func ConvertToStringInt64Map(originalMap map[string]interface{}) map[string]int64

func ConvertToStringInt8Map

func ConvertToStringInt8Map(originalMap map[string]interface{}) map[string]int8

func ConvertToStringIntMap

func ConvertToStringIntMap(originalMap map[string]interface{}) map[string]int

func ConvertToStringInterfaceMap

func ConvertToStringInterfaceMap(originalMap map[string]interface{}) map[string]string

func ConvertToStringStringMap

func ConvertToStringStringMap(originalMap map[string]interface{}) map[string]string

func ConvertToStringUint16Map

func ConvertToStringUint16Map(originalMap map[string]interface{}) map[string]uint16

func ConvertToStringUint32Map

func ConvertToStringUint32Map(originalMap map[string]interface{}) map[string]uint32

func ConvertToStringUint64Map

func ConvertToStringUint64Map(originalMap map[string]interface{}) map[string]uint64

func ConvertToStringUint8Map

func ConvertToStringUint8Map(originalMap map[string]interface{}) map[string]uint8

func ConvertToUint16Array

func ConvertToUint16Array(input []interface{}) []uint16

func ConvertToUint32Array

func ConvertToUint32Array(input []interface{}) []uint32

func ConvertToUint64Array

func ConvertToUint64Array(input []interface{}) []uint64

func ConvertToUint8Array

func ConvertToUint8Array(input []interface{}) []uint8

func ConvertToUintArray

func ConvertToUintArray(input []interface{}) []uint

func CopyDir

func CopyDir(src, dest string) error

func CopyFile

func CopyFile(src, dest string) error

func CopySelectFilesToDestination

func CopySelectFilesToDestination(c CopySelectFilesToDestinationStruct) error

func DecreaseChannelBatchFn

func DecreaseChannelBatchFn(i int, batchSize int, batchDone chan bool, targetArray []string)

func ExtractBranchNames

func ExtractBranchNames(input string) []string

func FilterArray

func FilterArray[T any](arr []T, condition func(interface{}, int) bool) []interface{}

func FilterJSONByPredicate

func FilterJSONByPredicate(inputJSON []byte, predicate func(key string, value interface{}) bool) ([]byte, error)

func FilterMap

func FilterMap[T any](originalMap map[string]T, predicate func(string, T) bool) map[string]interface{}

func FolderExists

func FolderExists(path string) bool

func GetCurrentBranch

func GetCurrentBranch() (string, error)

func GetCurrentPath

func GetCurrentPath() string

func GetInputFromStdin

func GetInputFromStdin(obj GetInputFromStdinStruct) string

func GetItemsInFolder

func GetItemsInFolder(folderPath string) ([]string, error)

func GetItemsInFolderRecursive

func GetItemsInFolderRecursive(folderPath string, recursive bool) ([]string, error)

func GetParamValue

func GetParamValue(parameterName string, parameterValue interface{}) interface{}

func GetType

func GetType(value interface{}) string

getType returns the type of a given value as a string

func GitSparseClone

func GitSparseClone(repoURL string, localDir string, subdirectories ...string) error

func HasPrefixInArray

func HasPrefixInArray(str string, prefixes []string, removeSuffix bool) string

func HasSuffixInArray

func HasSuffixInArray(str string, suffixes []string, removeSuffix bool) string

func IsFileOrFolder

func IsFileOrFolder(path string) (string, error)

func IsRunningInDocker added in v3.1.6

func IsRunningInDocker() bool

func JoinAndConvertPathToOSFormat

func JoinAndConvertPathToOSFormat(inputPathParts ...string) string

func MergeDirectories

func MergeDirectories(sourceDir, targetDir string, overwrite bool) error

func OverwriteFile

func OverwriteFile(filePath string, content string) error

func OverwriteMap

func OverwriteMap[T any](targetMap, newMap map[string]T)

func ProcessFilesMatchingPattern

func ProcessFilesMatchingPattern(directory, pattern string, predicateFn func(string)) error

func ProcessFoldersMatchingPattern added in v3.1.2

func ProcessFoldersMatchingPattern(directory, pattern string, predicateFn func(string)) error

func ReadFile

func ReadFile(filePath string) (string, error)

func RemoveDrivePath

func RemoveDrivePath(folderPath string) string

func Reverse

func Reverse(targetArray []string) []string

func RunCommand deprecated

func RunCommand(command string, args []string)

Deprecated: This function will be removed in the next major release. Use RunCommandWithOptions instead.

func RunCommandAndGetOutput deprecated

func RunCommandAndGetOutput(command string, args []string) string

Deprecated: This function will be removed in the next major release. Use RunCommandWithOptions instead.

func RunCommandInSpecifcDirectoryAndGetOutput deprecated

func RunCommandInSpecifcDirectoryAndGetOutput(command string, args []string, targetDir string) string

Deprecated: This function will be removed in the next major release. Use RunCommandWithOptions instead.

func RunCommandInSpecificDirectory deprecated

func RunCommandInSpecificDirectory(command string, args []string, targetDir string)

Deprecated: This function will be removed in the next major release. Use RunCommandWithOptions instead.

func RunCommandWithOptions

func RunCommandWithOptions(options CommandOptions) (string, error)

func ShowMenu

func ShowMenu(cliInfo ShowMenuModel, enableOtherOption interface{}) string

func TakeVariableArgs

func TakeVariableArgs(obj TakeVariableArgsStruct) string

func TraverseDirectory

func TraverseDirectory(config TraverseDirectoryParams) error

func TruncateStringByRegex

func TruncateStringByRegex(options TruncateStringByRegexOptions) string

func UnicodeUnquote

func UnicodeUnquote(bs []byte) []byte

func WriteCustomFormattedJSONToFile

func WriteCustomFormattedJSONToFile(data interface{}, filename string, indentString string) error

func WriteFormattoJSONFile

func WriteFormattoJSONFile(data interface{}, filename string)

Types

type AngularFrontendStruct

type AngularFrontendStruct struct {
	Configurations []string `json:"configurations"`
}

type CommandOptions

type CommandOptions struct {
	Command      string
	Args         []string
	TargetDir    string
	GetOutput    bool
	PanicOnError bool
}

type CopySelectFilesToDestinationStruct

type CopySelectFilesToDestinationStruct struct {
	SourceFiles    []string
	GlobPattern    string //regex
	DestinationDir string
}

type CreateStringObjectType added in v3.1.3

type CreateStringObjectType struct {
	Orig       string
	Prefix     func() string
	CamelCase  func(stripSuffix bool, suffix string) string
	Classify   func(stripSuffix bool, suffix string) string
	Capitalize func(stripSuffix bool, suffix string) string
	Dasherize  func(stripSuffix bool, suffix string) string
	Lowercase  func(stripSuffix bool, suffix string) string
	Uppercase  func(stripSuffix bool, suffix string) string
	Snakecase  func(stripSuffix bool, suffix string) string
}

CreateStringObjectType represents the structure of the string object.

func CreateStringObject added in v3.1.3

func CreateStringObject(myStr string, entitySuffix string) (CreateStringObjectType, error)

type GetInputFromStdinStruct

type GetInputFromStdinStruct struct {
	Prompt  []string
	ErrMsg  string
	Default string
}

type GetTestNGArgsStruct

type GetTestNGArgsStruct struct {
	WorkspaceFolder string
	EnvVarsFile     string
	TestNGFolder    string
	SuiteFile       string
	ParamEnv        string
}

type GitCloneSubdirsStruct

type GitCloneSubdirsStruct struct {
	RepoURL    string `json:"repoURL"`
	StagingDir string `json:"stagingDir"`
	Subdirs    string `json:"subdirs"`
	DestDir    string `json:"destDir"`
}

type MiscOptimizeImagesStruct

type MiscOptimizeImagesStruct struct {
	Location        string `json:"location"`
	BackupLocation  string `json:"backupLocation"`
	OptimizePercent string `json:"optimizePercent"`
}

type ShellCommandOutput

type ShellCommandOutput struct{}

func (ShellCommandOutput) Write

func (c ShellCommandOutput) Write(p []byte) (int, error)

type ShowMenuModel

type ShowMenuModel struct {
	Default     string
	Other       bool
	OtherString string
	Prompt      string
	Choices     []string       // items on the to-do list
	Selected    map[int]string // which to-do items are selected
	// contains filtered or unexported fields
}

func (ShowMenuModel) Init

func (m ShowMenuModel) Init() tea.Cmd

func (ShowMenuModel) Update

func (m ShowMenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ShowMenuModel) View

func (m ShowMenuModel) View() string

type TakeVariableArgsStruct

type TakeVariableArgsStruct struct {
	Prompt    string
	ErrMsg    string
	Default   string
	Delimiter string
}

type TraverseDirectoryParams

type TraverseDirectoryParams struct {
	RootDir   string
	Predicate func(string, os.FileInfo)
	Filter    func(string, os.FileInfo) bool
}

type TruncateStringByRegexOptions

type TruncateStringByRegexOptions struct {
	InputString  string
	RegexPattern string
	Predicate    func(int) bool
}

type VSCodeSettings

type VSCodeSettings struct {
	ExtensionPack WindmillcodeExtensionPack `json:"windmillcode-extension-pack-0"`
}

func GetSettingsJSON

func GetSettingsJSON(workSpaceFolder string) (VSCodeSettings, error)

type WindmillcodeExtensionPack

type WindmillcodeExtensionPack struct {
	FlaskBackendDevHelperScript  string                   `json:"flaskBackendDevHelperScript"`
	FlaskBackendTestHelperScript string                   `json:"flaskBackendTestHelperScript"`
	ProxyURLs                    string                   `json:"proxyURLs"`
	SQLDockerContainerName       string                   `json:"sqlDockerContainerName"`
	DatabaseName                 string                   `json:"databaseName"`
	DatabaseOptions              []string                 `json:"databaseOptions"`
	OpenAIAPIKey0                string                   `json:"openAIAPIKey0"`
	OpenAIAPIBase0               string                   `json:"openAIAPIBase0"`
	LangCodes0                   string                   `json:"langCodes0"`
	PythonVersion0               string                   `json:"pythonVersion0"`
	GitCloneSubdirs              GitCloneSubdirsStruct    `json:"gitCloneSubdirs"`
	MiscOptimizeImages           MiscOptimizeImagesStruct `json:"miscOptimizeImages"`
	AngularFrontend              AngularFrontendStruct    `json:"angularFrontend"`
}

Jump to

Keyboard shortcuts

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