Documentation ¶
Index ¶
- func CopyDir(src, dst *Path) error
- func CopyFile(src, dst *Path) error
- func ErrorString(err error) string
- func FileCompareEqual(file1, file2 *Path) bool
- func FormatArgs(args ...interface{}) string
- func PanicIf(cond bool, args ...interface{})
- func PanicIfErr(err error, args ...interface{})
- func ReadJsonFile(jsonPath string) (interface{}, error)
- func ReadJsonFileToData(jsonPath string, jsonOut interface{}) error
- type ExecCmd
- type Path
- func (p *Path) Absolute() string
- func (p *Path) Append(s string) *Path
- func (p *Path) Base() string
- func (p *Path) Chmod(mode os.FileMode) error
- func (p *Path) Clean() string
- func (p *Path) Copy() *Path
- func (p *Path) CreateDir() error
- func (p *Path) DeleteFile() error
- func (p *Path) Dir() string
- func (p *Path) Expand(mapping func(string) string) *Path
- func (p *Path) IsPathDir() bool
- func (p *Path) IsPathRegularFile() bool
- func (p *Path) ModTime() time.Time
- func (p *Path) Mode() os.FileMode
- func (p *Path) RemoveDir() error
- func (p *Path) SetStr(s string)
- func (p *Path) Size() int64
- func (p *Path) String() string
- type SharedData
- func (s *SharedData) Cmd() string
- func (s *SharedData) DataPath() string
- func (s *SharedData) Debug() bool
- func (s *SharedData) Defn(nm string) interface{}
- func (s *SharedData) Force() bool
- func (s *SharedData) Funcs() map[string]interface{}
- func (s *SharedData) FuncsSlice() []interface{}
- func (s *SharedData) GenDebugging() bool
- func (s *SharedData) GenLogging() bool
- func (s *SharedData) GenMuxWrapper() bool
- func (s *SharedData) Init()
- func (s *SharedData) IsDefined(nm string) bool
- func (s *SharedData) MainPath() string
- func (s *SharedData) MergeFrom(m map[string]interface{}, rep bool)
- func (s *SharedData) MergeTo(m map[string]interface{}, rep bool)
- func (s *SharedData) Noop() bool
- func (s *SharedData) OutDir() string
- func (s *SharedData) Quiet() bool
- func (s *SharedData) Replace() bool
- func (s *SharedData) SetCmd(f string)
- func (s *SharedData) SetDataPath(f string)
- func (s *SharedData) SetDebug(f bool)
- func (s *SharedData) SetDefn(nm string, d interface{})
- func (s *SharedData) SetForce(f bool)
- func (s *SharedData) SetFunc(nm string, d interface{})
- func (s *SharedData) SetMainPath(f string)
- func (s *SharedData) SetNoop(f bool)
- func (s *SharedData) SetOutDir(f string)
- func (s *SharedData) SetQuiet(f bool)
- func (s *SharedData) SetReplace(f bool)
- func (s *SharedData) SetTime(f string)
- func (s *SharedData) String() string
- func (s *SharedData) Time() string
- type StringBuilder
- type WorkQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir copies from the given directory (src) and all of its files to the destination (dst).
func CopyFile ¶
CopyFile copies a file given by its path (src) creating an output file given its path (dst)
func ErrorString ¶
func FileCompareEqual ¶
FileCompareEqual compares two files returning true if they are equal.
func FormatArgs ¶
func FormatArgs(args ...interface{}) string
func PanicIfErr ¶
func PanicIfErr(err error, args ...interface{})
func ReadJsonFile ¶
ReadJsonFile preprocesses out comments and then unmarshals the data generically.
func ReadJsonFileToData ¶
ReadJsonFileToData preprocesses out comments and then unmarshals the data into a data structure previously defined.
Types ¶
type ExecCmd ¶
type ExecCmd struct {
// contains filtered or unexported fields
}
os.Exec contains further details
func NewExecCmd ¶
func (*ExecCmd) CommandString ¶
func (*ExecCmd) QuoteArgIfNeeded ¶
func (*ExecCmd) RunWithOutput ¶
RunWithOutput runs the previously set up command, gets the combined output of sysout and syserr, trims whitespace from it and returns if error free. If any error occurs, it is simply returned.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path provides a centralized
func NewCurrentWorkDir ¶ added in v1.0.3
func NewCurrentWorkDir() *Path
NewCurrentWorkDir returns the current working directory as a Path.
func NewHomeDir ¶
func NewHomeDir() *Path
NewHomeDir returns the current working directory as a Path.
func (*Path) Append ¶
Append a subdirectory or file name[.file extension] to the path. If the string is empty, then '/' will be appended.
func (*Path) Base ¶
Base returns the last component of the path. If the path is empty, "." is returned.
func (*Path) CreateDir ¶
CreateDir assumes that this path represents a directory and creates it along with any parent directories needed as well.
func (*Path) DeleteFile ¶
DeleteFile assumes that this path represents a file and deletes it.
func (*Path) Dir ¶ added in v1.0.3
Dir returns everything but the last component of the path. If the directory portion is empty, then '.' is returned.
func (*Path) Expand ¶
Expand replaces ${var} or $var in the given path based on the mapping function returning a new path.
func (*Path) IsPathDir ¶
IsPathDir cleans up the supplied file path and then checks the cleaned file path to see if it is an existing standard directory.
func (*Path) IsPathRegularFile ¶
IsPathRegularFile cleans up the supplied file path and then checks the cleaned file path to see if it is an existing standard file.
type SharedData ¶ added in v1.0.1
type SharedData struct {
// contains filtered or unexported fields
}
SharedData represents a common structure to share data across packages easily. It would normally be created in package, main, and passed as needed to other packages.
func (*SharedData) Cmd ¶ added in v1.0.1
func (s *SharedData) Cmd() string
func (*SharedData) DataPath ¶ added in v1.0.1
func (s *SharedData) DataPath() string
DataPath is the path to the app json file.
func (*SharedData) Debug ¶ added in v1.0.1
func (s *SharedData) Debug() bool
func (*SharedData) Defn ¶ added in v1.0.1
func (s *SharedData) Defn(nm string) interface{}
func (*SharedData) Force ¶ added in v1.0.1
func (s *SharedData) Force() bool
func (*SharedData) Funcs ¶ added in v1.0.1
func (s *SharedData) Funcs() map[string]interface{}
func (*SharedData) FuncsSlice ¶ added in v1.0.1
func (s *SharedData) FuncsSlice() []interface{}
func (*SharedData) GenDebugging ¶ added in v1.0.1
func (s *SharedData) GenDebugging() bool
func (*SharedData) GenLogging ¶ added in v1.0.1
func (s *SharedData) GenLogging() bool
func (*SharedData) GenMuxWrapper ¶ added in v1.0.1
func (s *SharedData) GenMuxWrapper() bool
func (*SharedData) Init ¶ added in v1.0.1
func (s *SharedData) Init()
func (*SharedData) IsDefined ¶ added in v1.0.1
func (s *SharedData) IsDefined(nm string) bool
func (*SharedData) MainPath ¶ added in v1.0.1
func (s *SharedData) MainPath() string
MainPath is the path to the main json file.
func (*SharedData) MergeFrom ¶ added in v1.0.1
func (s *SharedData) MergeFrom(m map[string]interface{}, rep bool)
MergeFrom merges the given map into the shared data definitions optionally replacing any that already exist.
func (*SharedData) MergeTo ¶ added in v1.0.1
func (s *SharedData) MergeTo(m map[string]interface{}, rep bool)
MergeTo merges the shared into the given map optionally replacing any in the given map.\
func (*SharedData) Noop ¶ added in v1.0.1
func (s *SharedData) Noop() bool
func (*SharedData) OutDir ¶ added in v1.0.1
func (s *SharedData) OutDir() string
func (*SharedData) Quiet ¶ added in v1.0.1
func (s *SharedData) Quiet() bool
func (*SharedData) Replace ¶ added in v1.0.1
func (s *SharedData) Replace() bool
func (*SharedData) SetCmd ¶ added in v1.0.1
func (s *SharedData) SetCmd(f string)
func (*SharedData) SetDataPath ¶ added in v1.0.1
func (s *SharedData) SetDataPath(f string)
func (*SharedData) SetDebug ¶ added in v1.0.1
func (s *SharedData) SetDebug(f bool)
func (*SharedData) SetDefn ¶ added in v1.0.1
func (s *SharedData) SetDefn(nm string, d interface{})
func (*SharedData) SetForce ¶ added in v1.0.1
func (s *SharedData) SetForce(f bool)
func (*SharedData) SetFunc ¶ added in v1.0.1
func (s *SharedData) SetFunc(nm string, d interface{})
func (*SharedData) SetMainPath ¶ added in v1.0.1
func (s *SharedData) SetMainPath(f string)
func (*SharedData) SetNoop ¶ added in v1.0.1
func (s *SharedData) SetNoop(f bool)
func (*SharedData) SetOutDir ¶ added in v1.0.1
func (s *SharedData) SetOutDir(f string)
func (*SharedData) SetQuiet ¶ added in v1.0.1
func (s *SharedData) SetQuiet(f bool)
func (*SharedData) SetReplace ¶ added in v1.0.1
func (s *SharedData) SetReplace(f bool)
func (*SharedData) SetTime ¶ added in v1.0.1
func (s *SharedData) SetTime(f string)
func (*SharedData) String ¶ added in v1.0.1
func (s *SharedData) String() string
String returns a stringified version of the shared data
func (*SharedData) Time ¶ added in v1.0.1
func (s *SharedData) Time() string
MainPath is the path to the main json file.
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder is a composition of strings.Builder so that we can add supplemental functions such as formatted strings easily.
func NewStringBuilder ¶
func NewStringBuilder() *StringBuilder
func (*StringBuilder) Len ¶
func (s *StringBuilder) Len() int
func (*StringBuilder) String ¶
func (s *StringBuilder) String() string
func (*StringBuilder) WriteString ¶
func (s *StringBuilder) WriteString(format string) error
WriteString allows us to write a string to the buffer.
func (*StringBuilder) WriteStringf ¶
func (s *StringBuilder) WriteStringf(format string, a ...interface{}) error
WriteStringf allows us to write a formatted string.
type WorkQueue ¶
type WorkQueue struct {
// contains filtered or unexported fields
}
WorkQueue represents a one use only structure to execute multiple go routines easily.
func NewWorkQueue ¶
func (*WorkQueue) CloseAndWaitForCompletion ¶
func (w *WorkQueue) CloseAndWaitForCompletion()
func (*WorkQueue) CloseQueue ¶
func (w *WorkQueue) CloseQueue()