Documentation ¶
Index ¶
- Constants
- Variables
- func Abs(localPath string) (string, error)
- func CreateAnRandomFileWithContent(format string, args ...interface{}) (*os.File, string, error)
- func CreateFileWithSize(filePath string, fileSize int64) error
- func DoesDirExist(fileFolder string) bool
- func DoesFileExist(filePath string) bool
- func DoesPathExist(filePath string) bool
- func ErrorEqual(funcName string, id int, alert func(format string, args ...interface{}), ...) bool
- func ExpectEqual(funcName string, id int, alert func(format string, args ...interface{}), ...) bool
- func FilterSpace(components []string) []string
- func GetFileMd5(fd *os.File, offset, size int64, whence int) (string, error)
- func GetHomeDirOfUser() (string, error)
- func GetHostFromUrl(useUrl string) (string, error)
- func GetParentPath(lists []string, upLevel int) string
- func GetRandomString(size int64) string
- func GetSizeOfFile(filePath string) (int64, error)
- func InitTestFiles()
- func IsDirWritable(fileFolder string) bool
- func IsFileWritable(filePath string) bool
- func IsSymbolicLink(filePath string) (bool, error)
- func Match(pattern, name string) (matched bool, err error)
- func PrintWaiting(propmt string, stop chan bool)
- func PromptConfirm(format string, args ...interface{}) bool
- func ReadSortedDirNames(localPath string) ([]string, error)
- func StringMd5(strVal string) string
- func TranTimestamptoLocalTime(timestamp int64, newTimeForm string) string
- func TranUTCTimeStringToTimeStamp(utcTimeString, oldTimeForm string) (int64, error)
- func TranUTCtoLocalTime(utcTimeString, oldTimeForm, newTimeForm string) (string, error)
- func TryMkdir(pathToMake string) error
- type Bar
- type CompleteFuncInter
- type Finisher
Constants ¶
const ( MAX_BAR_LENGTH = 30 BAR_TYPE = "#" )
const (
BOS_PATH_SEPARATOR = "/"
)
const (
Separator = os.PathSeparator
)
Variables ¶
var ErrBadPattern = errors.New("syntax error in pattern")
ErrBadPattern indicates a globbing pattern was malformed.
var (
OsPathSeparator = fmt.Sprintf("%c", os.PathSeparator)
)
Functions ¶
func CreateAnRandomFileWithContent ¶
create a temp file and write content to this file
func CreateFileWithSize ¶
func ErrorEqual ¶
func ExpectEqual ¶
func GetFileMd5 ¶
calc the md5 of local file whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end
func GetHomeDirOfUser ¶
Geting home directory of current user
func GetParentPath ¶
func InitTestFiles ¶
func InitTestFiles()
func IsDirWritable ¶
check dir is writable TODO: have more efficient method?
func IsSymbolicLink ¶
check whether file is symbolic link
func Match ¶
Match reports whether name matches the shell file name pattern. The pattern syntax is:
pattern: { term } term: '*' matches any sequence '?' matches any single character '[' [ '^' ] { character-range } ']' character class (must be non-empty) c matches character c (c != '*', '?', '\\', '[') '\\' c matches character c character-range: c matches character c (c != '\\', '-', ']') '\\' c matches character c lo '-' hi matches character c for lo <= c <= hi
Match requires pattern to match all of name, not just a substring. The only possible returned error is ErrBadPattern, when pattern is malformed.
On Windows, escaping is disabled. Instead, '\\' is treated as path separator.
func PrintWaiting ¶
Provide dynamic waiting propmt. stop: send signal to stop PrintWaiting
func PromptConfirm ¶
func ReadSortedDirNames ¶
Get sorted files and dir names from dir
func TranTimestamptoLocalTime ¶
Change timestamp to local time
func TranUTCTimeStringToTimeStamp ¶
Change UTC time string to timestamp
func TranUTCtoLocalTime ¶
Change UTC time string to local time string