utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShipStoreDirName = ".ship"
)

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains(arr []string, str string) bool

check array contains

func GetFilePathAndName

func GetFilePathAndName(path string) (string, string)

func GetLogContenteKeyvals

func GetLogContenteKeyvals() []interface{}

func GetLogFilePath

func GetLogFilePath(filename string) (string, error)

func GetPackageStorePathByNames

func GetPackageStorePathByNames(packageNames ...string) (string, error)

func IsFileExist

func IsFileExist(path string) bool

func MergePath

func MergePath(paths ...string) string

func NewLog

func NewLog(conf *conf.Bootstrap) (*logtool, error)

func ReadLastNLines

func ReadLastNLines(file *os.File, n int) (string, error)

ReadLastNLines reads the last n lines from a file.

Types

type Bash

type Bash struct {
	// contains filtered or unexported fields
}

func NewBash

func NewBash(log *log.Helper) *Bash

func (*Bash) RunCommand

func (b *Bash) RunCommand(command string, args ...string) (output string, err error)

func (*Bash) RunCommandWithLogging

func (b *Bash) RunCommandWithLogging(command string, args ...string) error

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(path, name string, resume bool) (*File, error)

func (*File) ClearFileContent

func (f *File) ClearFileContent() error

func (*File) Close

func (f *File) Close() error

func (*File) GetFileFullPath

func (f *File) GetFileFullPath() string

func (*File) GetFileName

func (f *File) GetFileName() string

func (*File) GetFilePath

func (f *File) GetFilePath() string

func (*File) Read

func (f *File) Read() ([]byte, error)

func (*File) Write

func (f *File) Write(chunk []byte) error

Jump to

Keyboard shortcuts

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