Documentation
¶
Index ¶
- Constants
- func AskConfirm(ioReader io.Reader, question string) (bool, error)
- func AtoiUint64(str string) (uint64, error)
- func Bold(s string) string
- func CheckRecommendedBinaries(binaries ...string)
- func CollectWalFiles(paths []string, isRecursive bool) ([]string, error)
- func CreateDirectory(dirName string, fileMode os.FileMode) error
- func ExtractTarGz(tarName, dstDir string) error
- func FileLinesScanner(reader io.Reader) *bufio.Scanner
- func FileSHA256Hex(path string) (string, error)
- func FindNamedMatches(pattern *regexp.Regexp, str string) map[string]string
- func FsCopyFileChangePerms(fsys fs.FS, src, dst string, perms int) error
- func GetFileContentBytes(path string) ([]byte, error)
- 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 any) (string, error)
- func GetYamlFileName(fileName string, mustExist bool) (string, error)
- func InternalError(format string, f VersionFunc, err ...any) error
- func IsDir(filePath string) bool
- func IsRegularFile(filePath string) bool
- func IsValidCommitHash(hash string) (bool, error)
- func JoinAbspath(paths ...string) (string, error)
- func JoinPaths(paths ...string) string
- func Max(x, y int) int
- func NewArgError(text string) error
- func ParseYAML(path string) (map[string]any, error)
- func PrintFromStart(file *os.File) error
- func RunCommand(cmd *exec.Cmd, workingDir string, showOutput bool) error
- func StringToTimestamp(input string) (string, error)
- type ArgError
- 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 CheckRecommendedBinaries ¶
func CheckRecommendedBinaries(binaries ...string)
CheckRecommendedBinaries warns if some binaries not found in PATH.
func CollectWalFiles ¶
CollectWalFiles collects WAL (Write-Ahead Log) files based on the given set of paths. It identifies files with ".snap" or ".xlog" extensions as WAL files. For directory paths, it traverses them based on the isRecursive flag. It skips directories or files it cannot access due to permissions, logging warnings.
The function ensures that ".snap" files are sorted before ".xlog" files in the result, and that the returned list contains unique absolute paths.
Returns: A sorted, unique slice of strings containing the absolute paths of collected WAL files.
func CreateDirectory ¶
CreateDirectory create a directory with existence and error checks.
func ExtractTarGz ¶
ExtractTarGz extracts tar.gz archive.
func FileLinesScanner ¶
FileLinesScanner returns scanner for file.
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 FsCopyFileChangePerms ¶
FsCopyFileChangePerms copies file from the certain FS with changing perms.
func GetFileContentBytes ¶
GetFileContentBytes returns file content as a bytes slice.
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 InternalError ¶
func InternalError(format string, f VersionFunc, err ...any) error
InternalError shows error information, version of tt and call stack.
func IsRegularFile ¶
IsRegularFile checks if filePath is a regular file. Returns true if the file exists and it is a regular file.
func IsValidCommitHash ¶
IsValidCommitHash checks hash format.
func JoinAbspath ¶
JoinAbspath concat paths and makes the resulting path absolute.
func NewArgError ¶
NewArgError creates and returns new argument error.
func PrintFromStart ¶
func RunCommand ¶
RunCommand runs specified command and returns an error. If showOutput is set to true, command output is shown. Else the output is kept aside, shown only if the command fails, and a spinner is shown on the log's terminal while the command runs.
func StringToTimestamp ¶
StringToTimestamp transforms string with number or RFC339Nano time to <sec.nanosecond> timestamp string.
Types ¶
type ArgError ¶
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.