cookies

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkDirHistory = []string{}

WorkDirHistory is the working directory stack used by Pushd and Popd functions.

Functions

func CopyFile

func CopyFile(src, dst string, overwrite bool) error

CopyFile copies the single file 'src' to 'dst'.

func CreateFiles

func CreateFiles(root string, mode os.FileMode, files map[string][]byte) error

CreateFiles creates the files and directories within 'files' with 'root' as the root directory. 'files' contains a set of relative file paths mapped to the their required content. If the file is a directory it must be suffixed with a '/' and the mapped data will be ignored.

func FileExists

func FileExists(f string) (bool, error)

FileExists returns true if the file exists, false if not, and an error if file existence could not be determined.

func FileToQuote

func FileToQuote(file string) (string, error)

FileToQuote returns the bytes of the input file as as a quoted string so it may be embedded in source code. Use []byte(quotedString) to decode.

func FmtDuration

func FmtDuration(t time.Duration, dp uint, radix time.Duration) string

FmtDuration returns the duration as a string using 'dp' to specify decimal points and 'radix' to specify units. Unit suffix is added only if it matches a metric time unit between (inclusive) nanoseconds and hours.

Print in milliseconds: ``` DurationString(time.Millisecond) ```

Custom radix in relation to time.Nanosecond: ``` // tens of microseconds DurationString(10 * 1000 * 1000) ```

func IndentLines

func IndentLines(n int, v string, s string) string

Indent creates a prefix of 'n' instances of 'v' which it prepends to each line of 's'. Returns 's' unchanged if 'n' is 0 or 'v' is empty. A panic occurs if 'n' is negative.

func IsDir

func IsDir(f string) (bool, error)

IsDir returns true if the file exists and is a directory. An error is returned if this could not be determined.

func IsRegFile

func IsRegFile(f string) (bool, error)

IsRegFile returns true if the file exists and is a regular file. An error is returned if this could not be determined.

func NoCheckCopyFile

func NoCheckCopyFile(src, dst string) error

NoCheckCopyFile copies the single file 'src' to 'dst' and doesn't make any attempt to check the file paths before hand.

func Popd

func Popd() error

Popd emulates the popd bash command.

func Pushd

func Pushd(dir string) error

Pushd emulates pushd bash command.

func SameFile

func SameFile(a, b string) (bool, error)

SameFile returns true if the two files 'a' and 'b' describe the same file as determined by os.SameFile. An error is returned if the file info could not be retreived for either file.

func StripSpace

func StripSpace(s string) string

StripSpace removes all white space from a string.

func ToUnixMilli

func ToUnixMilli(t time.Time) int64

ToUnixMilli returns the input Time as Unix milliseconds.

func Wrap

func Wrap(e error, m string, args ...interface{}) error

Wrap wraps an error 'e' with a another message 'm'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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