common

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package common ...

Package common ...

Package common ...

Package common ...

Package common ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMaxArgs

func CheckMaxArgs(items []string, max int) error

CheckMaxArgs returns an error if there are more than N args.

func CheckMinMaxArgs

func CheckMinMaxArgs(items []string, min int, max int) error

CheckMinMaxArgs returns an error if the number of args is not within the expected range.

func Contains

func Contains(s []string, str string) bool

Contains returns true if an element is in a slice.

func CopyFileFromEmbeddedFS

func CopyFileFromEmbeddedFS(efs *embed.FS, fs afero.Fs, pathToFile string, saveTo string) error

CopyFileFromEmbeddedFS copy files from the embedded file system to the actual file system.

func DirExists

func DirExists(fs afero.Fs, path string) bool

DirExists returns true if the directory/folder exists.

func FileExists

func FileExists(fs afero.Fs, path string) (bool, error)

FileExists returns true if the file exists.

func GetPromptObjectKeys added in v0.7.0

func GetPromptObjectKeys(po []config.PromptObject) []string

GetPromptObjectKeys returns a slice of string with Ids.

func HelperTextDeploySummary added in v0.4.0

func HelperTextDeploySummary(numOfFolders, numOfFiles int) string

HelperTextDeploySummary returns a 'summary' text for commands like deploy.

func HelperTextDryRunFlag added in v0.4.0

func HelperTextDryRunFlag() string

HelperTextDryRunFlag returns a text used when running an action in dry-run mode.

func HelperTextNewProject added in v0.3.0

func HelperTextNewProject(projectName string) string

HelperTextNewProject returns a 'next step' text used after the project creation.

func HelperTextNewProjectWithExistingTheme added in v0.8.0

func HelperTextNewProjectWithExistingTheme(projectName string) string

HelperTextNewProjectWithExistingTheme returns a 'next step' text used after the project creation when using an existing theme.

func HelperTextNewTheme added in v0.8.0

func HelperTextNewTheme(projectName string) string

HelperTextNewTheme returns a 'next step' text used after the theme creation.

func MkDir

func MkDir(fs afero.Fs, x ...string) error

MkDir is a wrapper for afero MkdirAll to create folder structure on the file system.

func MoveFile added in v0.7.0

func MoveFile(efs *embed.FS, fs afero.Fs, sourceFile string, saveTo string, backup bool) error

MoveFile copy files from the embedded file system to the actual file system and can backups them.

func PromptConfirm added in v0.5.0

func PromptConfirm(label string) string

PromptConfirm is used to ask for a yes or no (Y/N) question.

func PromptGetInput

func PromptGetInput(pc config.PromptContent, validate func(string) error, defaultValue string) (string, error)

PromptGetInput is used to prompt an input the user and retrieve the value.

func PromptGetSelect

func PromptGetSelect(pc config.PromptContent, items interface{}, withTemplates bool) (string, error)

PromptGetSelect is used to prompt a list of available options to the user and retrieve the selection.

func ReadFileLineByLine added in v0.5.2

func ReadFileLineByLine(appFs afero.Fs, filepath string) ([]string, error)

ReadFileLineByLine returns a slice of strings representing lines of the input file.

func ShowDeployCommandWarningMessages added in v0.5.0

func ShowDeployCommandWarningMessages(log *logger.Logger)

ShowDeployCommandWarningMessages display a set of useful information for the deploy over FTP process.

func TouchFile

func TouchFile(fs afero.Fs, x ...string) error

TouchFile is used to create a file on the file system.

func Union added in v0.5.2

func Union(a, b []string) []string

Union returns a slice containing the unique values of the input slices.

func UnionMap added in v0.7.0

func UnionMap(m1, m2 map[string]string) map[string]string

UnionMap returns a map joining elements from the inputs.

func Unique added in v0.5.2

func Unique(s []string) []string

Unique removes duplicated entries from a slice of strings.

func WriteToDisk

func WriteToDisk(fs afero.Fs, inpath string, r io.Reader) (err error)

WriteToDisk writes content to a file on the file system. Returns error if something went wrong.

Types

This section is empty.

Jump to

Keyboard shortcuts

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