Documentation
¶
Index ¶
- Constants
- func ColorLog(format string, a ...interface{})
- func ColorLogS(format string, a ...interface{}) string
- func ExecCmd(cmdName string, args ...string) (string, string, error)
- func ExecCmdBytes(cmdName string, args ...string) ([]byte, []byte, error)
- func ExecCmdDir(dir, cmdName string, args ...string) (string, string, error)
- func ExecCmdDirBytes(dir, cmdName string, args ...string) ([]byte, []byte, error)
- func FileExists(name string) bool
- func FindTreeIds(root *Tree) []int
- func GetTreeByDepList(rootid int, datas []Dep, root *Tree)
- func InArray(val string, arr []string) (exist bool, index int)
- func InIntArray(v int, sl []int) bool
- func InUint64Array(v uint64, sl []uint64) bool
- func IsChineseChar(str string) bool
- func IsDir(dir string) bool
- func IsEmail(b []byte) bool
- func IsFile(filePath string) bool
- func NewPool(n, bufSize int) *pool
- func Nl2br(s string) string
- func Now() int
- func String2Timestamp(str string) int64
- func Substr(s string, start, length int) string
- func Timestamp2String(timestamp int) string
- func VerCompare(ver1, ver2 string) int
- type Dep
- type Tree
Constants ¶
const ( Gray = uint8(iota + 90) Red Green Yellow Blue Magenta // NRed = uint8(31) // Normal EndColor = "\033[0m" )
Color number constants.
Variables ¶
This section is empty.
Functions ¶
func ColorLog ¶
func ColorLog(format string, a ...interface{})
ColorLog prints colored log to stdout. See color rules in function 'ColorLogS'.
func ColorLogS ¶
ColorLogS colors log and return colored content. Log format: <level> <content [highlight][path]> [ error ]. Level: TRAC -> blue; ERRO -> red; WARN -> Magenta; SUCC -> green; others -> default. Content: default; path: yellow; error -> red. Level has to be surrounded by "[" and "]". Highlights have to be surrounded by "# " and " #"(space), "#" will be deleted. Paths have to be surrounded by "( " and " )"(space). Errors have to be surrounded by "[ " and " ]"(space). Note: it hasn't support windows yet, contribute is welcome.
func ExecCmd ¶
ExecCmd executes sys command and return stdout, stderr in string type, along with possible error.
func ExecCmdBytes ¶
ExecCmdBytes executes sys command and return stdout, stderr in bytes type, along with possible error.
func ExecCmdDir ¶
ExecCmdDir executes sys command in given directory and return stdout, stderr in string type, along with possible error.
func ExecCmdDirBytes ¶
ExecCmdDirBytes executes sys command in given directory and return stdout, stderr in bytes type, along with possible error.
func FileExists ¶
FileExists reports whether the named file or directory exists.