Documentation ¶
Index ¶
- Constants
- func AskConfirm(ioReader io.Reader, question string) (bool, error)
- func AtoiUint64(str string) (uint64, error)
- func BitHas32(b, flag uint32) bool
- func Bold(s string) string
- func Chdir(newPath string) (func() error, error)
- func CheckRecommendedBinaries(binaries ...string)
- func CheckRequiredBinaries(binaries ...string) error
- func CheckVersionFromGit(basePath string) (string, error)
- func ConcatBuffers(dest *bytes.Buffer, sources ...*bytes.Buffer) error
- func CopyFileChangePerms(src string, dst string, perms int) error
- func CopyFilePreserve(src string, dst string) error
- func CreateDirectory(dirName string, fileMode os.FileMode) error
- func CreateSymlink(oldName string, newName string, overwrite bool) error
- func ExecuteCommand(program string, isVerbose bool, writer io.Writer, workDir string, ...) error
- func ExecuteCommandGetOutput(program string, workDir string, stdinData []byte, args ...string) ([]byte, error)
- func ExecuteCommandStdin(program string, isVerbose bool, logFile *os.File, workDir string, ...) error
- func ExtractTar(tarName string) error
- func ExtractTarGz(tarName string, dstDir string) error
- func FileLinesScanner(reader io.Reader) *bufio.Scanner
- func FileMD5(path string) ([]byte, error)
- func FileMD5Hex(path string) (string, error)
- func FileSHA1Hex(path string) (string, error)
- func FileSHA256Hex(path string) (string, error)
- func Find(src []string, find string) int
- func FindNamedMatches(re *regexp.Regexp, str string) map[string]string
- func GetArch() (string, error)
- func GetFileContent(path string) (string, error)
- func GetFileContentBytes(path string) ([]byte, error)
- func GetHelpCommand(cmd *cobra.Command) *cobra.Command
- func GetHomeDir() (string, error)
- func GetLastNLines(filepath string, linesN int) ([]string, error)
- func GetLastNLinesBegin(filepath string, lines int) (int64, error)
- func GetTextTemplatedStr(text *string, obj interface{}) (string, error)
- func GetYamlFileName(fileName string, mustExist bool) (string, error)
- func InstantiateFileFromTemplate(templatePath string, templateContent string, params map[string]interface{}) error
- func InternalError(format string, f VersionFunc, err ...interface{}) error
- func IsApp(path string) bool
- func IsDir(filePath string) bool
- func IsExecOwner(path string) (bool, error)
- func IsGitFetchJobsSupported() bool
- func IsPullRequest(input string) (bool, string)
- func IsRegularFile(filePath string) bool
- func IsValidCommitHash(hash string) (bool, error)
- func JoinAbspath(paths ...string) (string, error)
- func Max(x, y int) int
- func MergeFiles(destFilePath string, srcFilePaths ...string) error
- func Min[T constraints.Ordered](a, b T) T
- func NewArgError(text string) error
- func ParseYAML(path string) (map[string]interface{}, error)
- func PrintFromStart(file *os.File) error
- func ReadEmbedFile(fs embed.FS, path string) (string, error)
- func ReadEmbedFileBinary(fs embed.FS, path string) ([]byte, error)
- func RelativeToCurrentWorkingDir(fullpath string) string
- func ResolveSymlink(linkPath string) (string, error)
- func RunCommand(cmd *exec.Cmd, workingDir string, showOutput bool) error
- func RunCommandAndGetOutput(program string, args ...string) (string, error)
- func RunHook(hookPath string, showOutput bool) error
- func StartCommandSpinner(readyChannel readyChan, wg *sync.WaitGroup, prefix string)
- func StringSHA1Hex(source string) string
- func WriteYaml(fileName string, o interface{}) error
- type AppListEntry
- type ArgError
- type OsType
- type VersionFunc
Constants ¶
const MinCommitHashLength = 7
MinCommitHashLength is the Git default for a short SHA.
Variables ¶
This section is empty.
Functions ¶
func AskConfirm ¶
AskConfirm asks the user for confirmation and returns true if yes.
func Chdir ¶
Chdir changes current directory and updates PWD environment var accordingly. This can be useful for some scripts, which use getenv('PWD') to get working directory.
func CheckRecommendedBinaries ¶
func CheckRecommendedBinaries(binaries ...string)
CheckRecommendedBinaries warns if some binaries not found in PATH.
func CheckRequiredBinaries ¶
CheckRequiredBinaries returns an error if some binaries not found in PATH
func CheckVersionFromGit ¶
CheckVersionFromGit enters the passed path, tries to get a git version it is a git repo, parses and returns a normalized string.
func ConcatBuffers ¶
ConcatBuffers appends sources content to dest.
func CopyFileChangePerms ¶
CopyFileChangePerms copies file from source to destination with changing perms.
func CopyFilePreserve ¶
CopyFilePreserve copies file from source to destination with perms.
func CreateDirectory ¶
CreateDirectory create a directory with existence and error checks.
func CreateSymlink ¶
CreateSymlink creates newName as a symbolic link to oldName. Overwrites existing if overwrite flag is set.
func ExecuteCommand ¶
func ExecuteCommand(program string, isVerbose bool, writer io.Writer, workDir string, args ...string) error
ExecuteCommand executes program with given args in verbose or quiet mode.
func ExecuteCommandGetOutput ¶
func ExecuteCommandGetOutput(program string, workDir string, stdinData []byte, args ...string) ([]byte, error)
ExecuteCommandStdin executes program with given args in verbose or quiet mode and sends stdinData to stdin pipe.
func ExecuteCommandStdin ¶
func ExecuteCommandStdin(program string, isVerbose bool, logFile *os.File, workDir string, stdinData []byte, args ...string) error
ExecuteCommandStdin executes program with given args in verbose or quiet mode and sends stdinData to stdin pipe.
func ExtractTarGz ¶
ExtractTarGz extracts tar.gz archive.
func FileLinesScanner ¶
FileLinesScanner returns scanner for file.
func FileMD5Hex ¶
FileMD5Hex computes MD5 for a given file. The result is returned in a hex form.
func FileSHA1Hex ¶
FileSHA1Hex computes SHA1 for a given file. The result is returned in a hex form.
func FileSHA256Hex ¶
FileSHA256Hex computes SHA256 for a given file. The result is returned in a hex form.
func FindNamedMatches ¶
FindNamedMatches processes regexp with named capture groups and transforms output to a map. If capture group is optional and was not found, map value is empty string.
func GetFileContent ¶
GetFileContent returns file content as a string.
func GetFileContentBytes ¶
GetFileContentBytes returns file content as a bytes slice.
func GetHelpCommand ¶
GetHelpCommand returns the help command for the passed cmd argument.
func GetLastNLines ¶
GetLastNLines returns the last N lines from the file.
func GetLastNLinesBegin ¶
GetLastNLinesBegin return the position of last lines begin.
func GetTextTemplatedStr ¶
GetTextTemplatedStr returns the processed string text template.
func GetYamlFileName ¶
GetYamlFileName searches for file with .yaml or .yml extension, based on the file name provided. If mustExist flag is set and no yaml files are found, ErrNotExists error is returned, passed fileName is returned otherwise.
func InstantiateFileFromTemplate ¶ added in v0.3.0
func InstantiateFileFromTemplate(templatePath string, templateContent string, params map[string]interface{}) error
InstantiateFileFromTemplate accepts the path to file, template content and parameters for its filling.
func InternalError ¶
func InternalError(format string, f VersionFunc, err ...interface{}) error
InternalError shows error information, version of tt and call stack.
func IsExecOwner ¶
IsExecOwner checks if specified file has owner execute permissions.
func IsGitFetchJobsSupported ¶ added in v1.0.0
func IsGitFetchJobsSupported() bool
IsGitFetchJobsSupported checks if fetchJobs option (-j) is supported by current git version.
func IsPullRequest ¶ added in v1.3.0
IsPullRequest returns is this pull-request format and pr num.
func IsRegularFile ¶
isRegularFile checks if filePath is a regular file. Returns true if the file exists and it is a regular file.
func IsValidCommitHash ¶ added in v1.3.0
IsValidCommitHash checks hash format.
func JoinAbspath ¶
JoinAbspath concat paths and makes the resulting path absolute.
func MergeFiles ¶
MergeFiles creates a file that is a concatenation of srcFilePaths.
func Min ¶ added in v1.3.0
func Min[T constraints.Ordered](a, b T) T
Min returns minimal of two values.
func NewArgError ¶ added in v0.4.0
NewArgError creates and returns new argument error.
func PrintFromStart ¶
func ReadEmbedFile ¶
ReadEmbedFile reads content of embed file in string mode.
func ReadEmbedFileBinary ¶
ReadEmbedFileBinary reads content of embed file in byte mode.
func RelativeToCurrentWorkingDir ¶ added in v1.0.1
RelativeToCurrentWorkingDir returns a path relative to current working dir. In case of error, fullpath is returned.
func ResolveSymlink ¶
ResolveSymlink resolves symlink path.
func RunCommand ¶
RunCommand runs specified command and returns an error. If showOutput is set to true, command output is shown. Else spinner is shown while command is running.
func RunCommandAndGetOutput ¶
RunCommandAndGetOutput returns output of command.
func RunHook ¶
RunHook runs the specified hook. If showOutput is set to true, command output is shown.
func StartCommandSpinner ¶
StartCommandSpinner starts running spinner. until `ready` flag is received from the channel.
func StringSHA1Hex ¶
StringSHA1Hex computes SHA1 for a given string The result is returned in a hex form.
Types ¶
type AppListEntry ¶ added in v0.4.0
type AppListEntry struct { // Name is application name. Name string // Location is application source file or directory. Location string }
AppListEntry contains information about found application.
func CollectAppList ¶ added in v0.3.0
func CollectAppList(baseDir string, appsPath string, verbose bool) ([]AppListEntry, error)
CollectAppList collects all the supposed applications in passed appsPath directory.
type ArgError ¶ added in v0.4.0
type ArgError struct {
// contains filtered or unexported fields
}
ArgError represents command line arguments error.
type VersionFunc ¶
VersionFunc is a type of function that return string with current Tarantool CLI version.