Documentation ¶
Index ¶
- Constants
- func Abs(name string) (string, error)
- func ArrayStringDelete(a []string, element string) []string
- func BuildURLPath(aPath, repo, subpath, document string) (fullFileName string)
- func Cumulative(ref, value int) int
- func DefColor(colorNum int) (color, reset string)
- func EnsureDir(dir, mess string) (_ error)
- func Evaluate(value string, tmpl *template.Template, data interface{}, ...) (_ string, _ error)
- func InStringList(element string, elements ...string) string
- func Max(ref, value int) int
- func Min(ref, value int) int
- func ReadDocumentFrom(urls []*url.URL, repos, subPaths []string, document, contentType string) ([]byte, error)
- func RunCmd(command string, args ...string) int
- func RunCmdOutput(command string, args ...string) (string, int)
- func StringCompress(str string, min, max int) (ret string)
- func Touch(file string) error
- type EvalValues
- type MLoop
- type TerminalArray
Constants ¶
const RepoTag = "<repo>"
PluginTag to identify variable component name in a Document path.
const StringCompressMin = 7
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
Abs returns an absolute path
It expands ~ to $HOME If path is already absolute, it cleans up (shortest path). If the path is relative, it adds current directory to create it as absolute path
func ArrayStringDelete ¶
func BuildURLPath ¶
BuildURLPath build the path logic introducing the pluginTag to replace.
func Cumulative ¶
Max is the default function to evaluate values and result as Max
func InStringList ¶
func ReadDocumentFrom ¶
func ReadDocumentFrom(urls []*url.URL, repos, subPaths []string, document, contentType string) ([]byte, error)
ReadDocumentFrom is used to read a document from a url like github raw or directly from a local path It supports file or url stored in url.URL structure each urls can be defined with a plugin tag "<plugin>" which will be replaced by the document name(document) the file name and the extension is added at the end of the string.
func RunCmd ¶
Simple function to call a shell command and display to stdout stdout is displayed as is when it arrives, while stderr is displayed in Red, line per line.
func RunCmdOutput ¶
RunCmdOutput run a command and return the standard output as result. stderr is displayed in Red, line per line.
func StringCompress ¶
StringCompress compress a string to display to a maximum given if the str is higher, it will be cut in the middle with "..." min must be higher than 7 bytes. If max is lower than min, max will be set to min to ensure the size returned is never under min or 7 bytes
Types ¶
type EvalValues ¶
type EvalValues struct {
// contains filtered or unexported fields
}
EvalSizes stores max for each elements evaluated.
func NewEvalValues ¶
func NewEvalValues(index int) (ret *EvalValues)
NewEvalValues creates an EvalValues object
index : Number of evaluated values
func (*EvalValues) CountOf ¶
func (m *EvalValues) CountOf(index int) (ret int)
CountOf returns how many evaluation were executed on an indexed item
func (*EvalValues) Eval ¶
func (m *EvalValues) Eval(index, value int)
Eval is used to evaluate an item value with the select eval function
func (*EvalValues) EvalFunc ¶
func (m *EvalValues) EvalFunc(index int, evalFunc func(int, int) int)
EvalFunc change the default Eval method to your Method
Default is utils.Max ¶
Some predefined Eval functions:
- utils.Cumulative - utils.Max - utils.Min
func (*EvalValues) PrintfFormat ¶
func (m *EvalValues) PrintfFormat(format string, indexes ...int) string
PrintfFormat format an Printf format with indexed ValueOf() The format is interpreted by Sprintf
Ex: "%%-%ds" could be evaluated by "%-10s"
func (*EvalValues) ValueOf ¶
func (m *EvalValues) ValueOf(index int) (ret int)
ValueOf return the evaluated indexed value after multiple EvalValues.Eval().
type TerminalArray ¶
type TerminalArray struct {
// contains filtered or unexported fields
}
func NewTerminalArray ¶
func NewTerminalArray(linesNum, colsNum int) (ret *TerminalArray)
func (*TerminalArray) EvalLine ¶
func (t *TerminalArray) EvalLine(key string, cols ...int)
func (*TerminalArray) Print ¶
func (t *TerminalArray) Print(getLineData func(key string, compressedMax int) []interface{})
func (*TerminalArray) SetCol ¶
func (t *TerminalArray) SetCol(index int, header string)