com

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A_Repl      = 1 << iota // Replace input that matches with this - acts as a hard token
	A_EOF       = 1 << iota // Reached EOF
	A_Push      = 1 << iota // Call(x)
	A_Pop       = 1 << iota // Return
	A_Observe   = 1 << iota // Observe and report occurance of an item, continue processing
	A_Greedy    = 1 << iota // not used
	A_Reset     = 1 << iota // Reset stack to top level - restart machine (error recovery)
	A_NotGreedy = 1 << iota // Report token if if could be greedy and accumulate
	A_Error     = 1 << iota // Have an Error to report - often combined with A_Reset
	A_Warning   = 1 << iota // A warning to report
	A_Alias     = 1 << iota // An alias - replaces input and processes as if this was the original input (Different than A_Repl)
)

Variables

View Source
var (
	Red    = ansi.ColorCode("red")
	Yellow = ansi.ColorCode("yellow")
	Green  = ansi.ColorCode("green")
	Reset  = ansi.ColorCode("reset")
)
View Source
var DbOnFlags map[string]bool

------------------------------------------------------------------------------------------------------------------------------------------ Debug Print - controllable with flags. ------------------------------------------------------------------------------------------------------------------------------------------

View Source
var DbOnFlagsLock sync.Mutex
View Source
var ReservedActionNames = []string{"A_Repl", "A_EOF", "A_Push", "A_Pop", "A_Observe", "A_Greedy", "A_Reset", "A_NotGreedy", "A_Error", "A_Warning", "A_Alias"}
View Source
var ReservedActionToString map[int]string
View Source
var ReservedActionValues = map[string]int{
	"A_Repl":      A_Repl,
	"A_EOF":       A_EOF,
	"A_Push":      A_Push,
	"A_Pop":       A_Pop,
	"A_Observe":   A_Observe,
	"A_Greedy":    A_Greedy,
	"A_Reset":     A_Reset,
	"A_NotGreedy": A_NotGreedy,
	"A_Error":     A_Error,
	"A_Warning":   A_Warning,
	"A_Alias":     A_Alias,
}

Functions

func AllFilesInPath

func AllFilesInPath(path string) (filenames []string)

----------------------------------------------------------------------------------------------------------------------------------- Generate an array with all the files in the path -----------------------------------------------------------------------------------------------------------------------------------

func Basename

func Basename(fn string) (bn string)

------------------------------------------------------------------------------------------------- xyzzy - str. Return the basename from a file path. This is the last component with the directory path stripped off. File extension removed. -------------------------------------------------------------------------------------------------

func BasenameExt

func BasenameExt(fn string) (bn string)

------------------------------------------------------------------------------------------------- xyzzy - str. With file extension -------------------------------------------------------------------------------------------------

func ChkOrBlank

func ChkOrBlank(v bool) string

func ChkOrX

func ChkOrX(v bool) string

func CompareFiles

func CompareFiles(cmpFile string, refFile string) bool

------------------------------------------------------------------------------------------------- xyzzy - need "fast" version of "CompareFiles" with some limits on what it will use "fast" compare for - .jpg,.gif,.png fiels - a fiel size before uses fast etc. Compare Size? Compare name? What is the "fast" compare for rsync? -- Calculate Hashes for each and keep them around? -------------------------------------------------------------------------------------------------

func CompareSlices

func CompareSlices(X, Y []int) []int

func ConvertActionFlagToString

func ConvertActionFlagToString(kk int) (rv string)

func CopyFile

func CopyFile(src, dst string, useHardLink bool) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, if useHardLink is true, an attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func DbFprintf

func DbFprintf(db string, w io.Writer, format string, args ...interface{})

func DbOn

func DbOn(db string) (ok bool)

func DbPrintf

func DbPrintf(db string, format string, args ...interface{})

func DirExists

func DirExists(name string) bool

----------------------------------------------------------------------------------------------------------------------------------- Exists reports whether the named file or directory exists. -----------------------------------------------------------------------------------------------------------------------------------

func EqualStringSlices

func EqualStringSlices(X, Y []string) bool

func EscapeStr

func EscapeStr(v string, on bool) string

------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------

func Exists

func Exists(name string) bool

------------------------------------------------------------------------------------------------- Exists reports whether the named file or directory exists. -------------------------------------------------------------------------------------------------

func FILE

func FILE(d ...int) (rv string)

Return the current file name.

func FilterArray

func FilterArray(re string, inArr []string) (outArr []string)

------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------

func Fopen

func Fopen(fn string, mode string) (file *os.File, err error)

func GetFilenames

func GetFilenames(dir string) (filenames, dirs []string)

------------------------------------------------------------------------------------------------- Get a list of filenames and directorys. -------------------------------------------------------------------------------------------------

func GetFilenamesRecrusive

func GetFilenamesRecrusive(dir string) (filenames, dirs []string, err error)

------------------------------------------------------------------------------------------------- Get a list of filenames and directories. -------------------------------------------------------------------------------------------------

func GetTemplateFiles

func GetTemplateFiles(dir string) (fns []string, err error)

------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------

func InArray

func InArray(lookFor string, inArr []string) bool

func KeyStringSort

func KeyStringSort(str []string) (rv []string)

func LF

func LF(d ...int) (rv string)

Return the File name and Line no as a string.

func LINE

func LINE(d ...int) (rv string)

---------------------------------------------------------------------------------------------------------- Return the current line number as a string.

func LINEn

func LINEn(d ...int) (rv int)

func NameOf

func NameOf(inputSet []int) string

func ParseBool

func ParseBool(s string) (b bool)

func Qt

func Qt(format string, data map[string]string) string

QT: Quick template %{name%} gets replace with substitution from map if it is in map, else ""

func QtR

func QtR(format string, data map[string]interface{}) string

func ReplaceEach

func ReplaceEach(data []string, pat, repl string) (outArr []string)

------------------------------------------------------------------------------------------------- 1. For each dir - Create destination directies -o <name>/+/... ReplaceEach ( []string, pat, repl ) -------------------------------------------------------------------------------------------------

func RmExt

func RmExt(filename string) string

func SVar

func SVar(v interface{}) string

-------------------------------------------------------------------------------------------------

func SVarI

func SVarI(v interface{}) string

-------------------------------------------------------------------------------------------------

func SortMapStringString

func SortMapStringString(str map[string]string) (rv []string)

func StashError

func StashError(s string)

func USortIntSlice

func USortIntSlice(inputSet []int) (rv []int)

Types

type ErrorBufferType

type ErrorBufferType struct {
	Err []string
}
var ErrorBuffer ErrorBufferType

Jump to

Keyboard shortcuts

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