Documentation ¶
Index ¶
- Variables
- func BoolStatus(b bool) string
- func BoolString(b bool) string
- func BoolYesNo(b bool) string
- func BoxSealAnonymous(base64Pubkey, msg *string) *string
- func CurrentDirBase() *string
- func CurrentPath() *string
- func DebugEnv() bool
- func DebugLog(msg ...interface{})
- func ErrCheck(e error)
- func FullPath(workpathP *string) *string
- func GitExecExist() bool
- func GitExecPath() string
- func GitRemote(workpathP *string, v bool) *[]string
- func GitRemoteExist(workpathP *string, name string) bool
- func GitRemoteRemoveAll(workpathP *string)
- func GitRoot(workpathP *string) string
- func GitRootSubmodule(workpathP *string) string
- func JsonIndentSp(baP *[]byte, endLn bool) *string
- func Report(data any, title string, skipEmpty bool, singleLine bool)
- func ReportDebug(data any, title string, skipEmpty bool, singleLine bool)
- func ReportSp(data any, title string, skipEmpty bool, singleLine bool) *string
- func ReportSpDebug(data any, title string, skipEmpty bool, singleLine bool) *string
- func ReportStatus(data bool, title string, singleLine bool)
- func ReportStatusSp(data bool, title string, singleLine bool) *string
- func StrArrayPtrContain(aP *[]string, sP *string) bool
- func StrArrayPtrPrintln(saP *[]string)
- func StrArrayPtrPrintlnSp(saP *[]string) *string
- func StrArrayPtrRemoveEmpty(saP *[]string) *[]string
- func StrPtrToArrayPtr(sP *string) *[]string
- type MyCmd
- func Git(workpathP *string, optionsP *[]string) *MyCmd
- func GitBranchCurrent(workpathP *string) *MyCmd
- func GitClone(workpathP *string, optionsP *[]string) *MyCmd
- func GitInit(workpathP *string) *MyCmd
- func GitPull(workpathP *string, optionsP *[]string) *MyCmd
- func GitPush(workpathP *string, optionsP *[]string) *MyCmd
- func GitRemoteAdd(workpathP *string, name string, git string) *MyCmd
- func GitRemoteRemove(workpathP *string, name string) *MyCmd
- func MyCmdInit(name string, argsP *[]string, workpathP *string) *MyCmd
- func MyCmdRun(cmdName string, argsP *[]string, workpathP *string) *MyCmd
- func MyCmdRunWg(cmdName string, argsP *[]string, workpathP *string, title *string, ...) *MyCmd
- type ReportT
Constants ¶
This section is empty.
Variables ¶
var Debug bool = false
Debug flag for helper package.
Functions ¶
func BoxSealAnonymous ¶
Encrypt msg with public key using nacl box seal anonymous.
Parameter "base64Pubkey" and returning string are base64 encoded.
func CurrentDirBase ¶
func CurrentDirBase() *string
Get current directory name. Not full path. Return string pointer.
func CurrentPath ¶ added in v0.9.9
func CurrentPath() *string
Get full path of current directory. Return string pointer.
func FullPath ¶ added in v1.0.0
Return full path of path provided. If <workpathP> is empty/nil, use current path. <workpathP> not modified. Return string pointer.
func GitExecPath ¶ added in v0.9.9
func GitExecPath() string
Get git executable path. Return empty string if not found.
func GitRemote ¶
Run "git remote". If <workpathP> is empty/nil, current directory is used. Return remotes in string array.
func GitRemoteExist ¶
Check if a git remote(by name) exist in workpath. If <workpathP> is empty/nil, current directory is used.
func GitRemoteRemoveAll ¶
func GitRemoteRemoveAll(workpathP *string)
Run "git remote remove" all git remotes If <workpathP> is empty/nil, current directory is used.
func GitRoot ¶ added in v0.9.9
Get git root from current directory. If <workpathP> is empty/nil, current directory is used. Return empty string if not a git dir.
func GitRootSubmodule ¶ added in v0.9.9
Get git submodule root from `workpath`. If <workpathP> is empty/nil, current directory is used. Return empty string if not a submodule dir.
func JsonIndentSp ¶
Json indent *[]byte to *string. If <endLn> is true, add new line at end of string if not exist. Return string pointer.
func Report ¶
Print any data(optional) with title(optional). If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line.
func ReportDebug ¶
Only print if helper.Debug is true. Print any data(optional) with title(optional). If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line.
func ReportSp ¶
Print any data(optional) with title(optional) into a string. If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line. Return a string pointer.
func ReportSpDebug ¶ added in v0.9.8
Only print if helper.Debug is true. Print any data(optional) with title(optional) into a string. If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line. Return a string pointer.
func ReportStatus ¶
Print bool into true/false, with title(optional). If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line.
func ReportStatusSp ¶ added in v1.0.1
Only print if helper.Debug is true. Print bool into true/false, with title(optional), into a string. If <skipEmpty> is true, will not print title if <data> is empty. If <singleLine> is true, <data> will not start on new line. Return a string pointer.
func StrArrayPtrContain ¶
Check if string array contain a string.
func StrArrayPtrPrintlnSp ¶ added in v1.0.1
*string output
func StrArrayPtrRemoveEmpty ¶
Return a new *[]string with empty lines removed from *[]string. Original []string not modified.
func StrPtrToArrayPtr ¶ added in v1.0.0
Split *string to *[]string by new line("\n")
Types ¶
type MyCmd ¶
type MyCmd struct { ArgsP *[]string `json:"ArgsP"` // Command args CmdName string `json:"Name"` // Command name WorkDir string `json:"Dir"` // Command working dir Ran bool `json:"Ran"` // Out: Set to true by Run() CmdLn string `json:"CmdLn"` // Out: Command Line Err error `json:"Err"` // Out: run error Stdout bytes.Buffer `json:"Stdout"` // Out: Stdout Stderr bytes.Buffer `json:"Stderr"` // Out: Stderr }
A exec.Cmd wrapper
func Git ¶ added in v1.1.1
Run "git <optionsP>". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitBranchCurrent ¶ added in v1.1.1
Run "git branch --show-current". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitClone ¶ added in v1.1.1
Run "git clone <optionsP>". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitInit ¶
Run "git init". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitPull ¶ added in v1.1.1
Run "git pull <optionsP>". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitPush ¶
Run "git push <optionsP>". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitRemoteAdd ¶
Run "git remote add <name> <git>". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func GitRemoteRemove ¶
Run "git remote remove". If <workpathP> is empty/nil, current directory is used. Return a MyCmd pointer for execution information.
func MyCmdInit ¶ added in v0.9.9
Setup and return MyCmd pointer. If <workpathP> is empty/nil, current directory is used.
type ReportT ¶
type ReportT struct { Data any `json:"Data"` // Data to be printed Title string `json:"Title"` // Title of print out ModeStatus bool `json:"ModeStatus"` // bool to "OK/Failed" SkipEmpty bool `json:"SkipEmpty"` // Return empty string if Data is empty SingleLine bool `json:"SingleLine"` // No need line after title }
func ReportNew ¶
Setup ReportT with data(optional/nil), title(optional/""), <skipEmpty>, <singleLine>. Return the ReportT pointer.
func (*ReportT) String ¶
Print self.Data, self.Title to string If self.SkipEmpty is true, will not print self.Title if self.Data is empty. If self.SingleLine is true, self.Data will not start on new line.
func (*ReportT) StringDebug ¶
Only print if helper.Debug is true. Print self.Data, self.Title to string If self.SkipEmpty is true, will not print self.Title if self.Data is empty. If self.SingleLine is true, self.Data will not start on new line.
func (*ReportT) StringP ¶
Print self.Data, self.Title to string pointer If self.SkipEmpty is true, will not print self.Title if self.Data is empty. If self.SingleLine is true, self.Data will not start on new line.
func (*ReportT) StringPDebug ¶
Only print if helper.Debug is true. Print self.Data, self.Title to string pointer If self.SkipEmpty is true, will not print self.Title if self.Data is empty. If self.SingleLine is true, self.Data will not start on new line.