Documentation ¶
Overview ¶
Package bilib provides common stuff for bisync and bisync_test
Package bilib provides common stuff for bisync and bisync_test Here it's got local file/directory helpers (nice to have in lib/file)
Package bilib provides common stuff for bisync and bisync_test
Index ¶
- Constants
- func AppyTimeGlobs(s string, t time.Time) string
- func BasePath(ctx context.Context, workDir string, fs1, fs2 fs.Fs) string
- func CanonicalPath(remote string) string
- func CaptureOutput(fun func()) []byte
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func CopyFileIfExists(srcFile, dstFile string) error
- func FileExists(file string) bool
- func FsPath(f fs.Info) string
- func HasHexString(path string) bool
- func IsLocalPath(path string) bool
- func ParseGlobs(s string) (hasGlobs bool, substring string)
- func SaveList(list []string, path string) error
- func SessionName(fs1, fs2 fs.Fs) string
- func StripHexString(path string) string
- func TimeFormat(timeFormat string) string
- func TrimBrackets(s string) string
- type AliasMap
- type Names
Constants ¶
const PermSecure = 0600
PermSecure is a Unix permission for a file accessible only by its owner
Variables ¶
This section is empty.
Functions ¶
func AppyTimeGlobs ¶ added in v1.62.1
AppyTimeGlobs converts "myfile-{DateOnly}.txt" to "myfile-2006-01-02.txt"
func BasePath ¶ added in v1.62.1
BasePath joins the workDir with the SessionName, stripping {hexstring} suffix if necessary
func CanonicalPath ¶
CanonicalPath converts a remote to a suitable base file name
func CaptureOutput ¶
func CaptureOutput(fun func()) []byte
CaptureOutput runs a function capturing its output.
func CopyFileIfExists ¶
CopyFileIfExists is like CopyFile but does not fail if source does not exist
func FileExists ¶
FileExists returns true if the local file exists
func HasHexString ¶ added in v1.62.1
HasHexString returns true if path contains at least one canonical {hexstring} suffix
func IsLocalPath ¶
IsLocalPath returns true if its argument is a non-remote path. Empty string or a relative path will be considered local. Note: `c:dir` will be considered local on Windows but remote on Linux.
func ParseGlobs ¶ added in v1.62.1
ParseGlobs determines whether a string contains {brackets} and returns the substring (including both brackets) for replacing substring is first opening bracket to last closing bracket -- good for {{this}} but not {this}{this}
func SessionName ¶
SessionName makes a unique base name for the sync operation
func StripHexString ¶ added in v1.62.1
StripHexString strips the (first) canonical {hexstring} suffix
func TimeFormat ¶ added in v1.62.1
TimeFormat converts a user-supplied string to a Go time constant, if possible
func TrimBrackets ¶ added in v1.62.1
TrimBrackets converts {{this}} to this
Types ¶
type AliasMap ¶ added in v1.62.1
AliasMap comprises a pair of names that are not equal but treated as equal for comparison purposes For example, when normalizing unicode and casing This helps reduce repeated normalization functions, which really slow things down