helpers

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckToolIsInstalled

func CheckToolIsInstalled(name, versionCommand string) (bool, error)

CheckToolIsInstalled checks if a tool is installed by executing a command.

It takes the name of the tool and the command to retrieve the version as input. It returns the bool indicating if the tool is installed and any error encountered.

func CopyFilesFromEmbedFS

func CopyFilesFromEmbedFS(efs embed.FS, files []EmbedFile) error

CopyFilesFromEmbedFS function for copy all files from the embed file system.

func Execute

func Execute(commands []Command) error

Execute executes all commands with (or without) options.

func GenerateFilesByTemplateFromEmbedFS

func GenerateFilesByTemplateFromEmbedFS(efs embed.FS, templates []EmbedTemplate) error

GenerateFilesByTemplateFromEmbedFS generates new files from the given template with variables from embed FS.

func GetToolVersion

func GetToolVersion(name, versionCommand string) (string, error)

GetToolVersion gets the version of a tool by executing a command.

It takes the name of the tool and the command to retrieve the version as input. It returns the version as a string and any error encountered.

func IsExistInFolder

func IsExistInFolder(name string, isFolder bool) bool

IsExistInFolder searches for a file or folder by the given name in the current folder.

func MakeFile

func MakeFile(file File) error

MakeFile makes a single file with name and data.

func MakeFiles

func MakeFiles(files []File) error

MakeFiles makes a multiply files with names and data.

func MakeFolders

func MakeFolders(names ...string) error

MakeFolders makes a multiply folders with names.

func MakeStyled

func MakeStyled(s string, style *StringStyle) string

MakeStyled returns a styled string.

func MakeStyledFrame

func MakeStyledFrame(s string, style *FrameStyle) string

MakeStyledFrame returns a styled frame.

func RunSpinnerWithContext

func RunSpinnerWithContext(ctx context.Context, title string, spinnerType spinner.Type) error

RunSpinnerWithContext runs the spinner with the given context.

Types

type Command

type Command struct {
	SkipOutput       bool
	Name             string
	Options, EnvVars []string
}

Command represents a struct for cmd commands.

type EmbedFile

type EmbedFile struct {
	EmbedFile  string
	OutputFile string
}

EmbedFile represent struct for embed file system.

type EmbedTemplate

type EmbedTemplate struct {
	EmbedFile  string
	OutputFile string
	Data       any
}

EmbedTemplate represents struct for a one template.

type File

type File struct {
	Name string
	Data []byte
}

File represent a struct to a file.

type FrameStyle

type FrameStyle struct {
	Padding []int
	Color   lipgloss.AdaptiveColor
}

FrameStyle represents a styled frame.

type StringStyle

type StringStyle struct {
	IsBold bool
	Color  lipgloss.AdaptiveColor
}

StringStyle represents a styled string.

Jump to

Keyboard shortcuts

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