From b941df68e17ec2291d8150da306d965dfb50ca98 Mon Sep 17 00:00:00 2001 From: Aidan Date: Sat, 18 Jul 2020 14:45:36 -0700 Subject: [PATCH] godoc for extra packages --- config/config.go | 4 ++++ log/logger.go | 7 +++++++ util/scripts.go | 2 ++ util/shell_complete.go | 6 ++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index bf4c303..fc8eda3 100644 --- a/config/config.go +++ b/config/config.go @@ -24,6 +24,10 @@ import ( "gitlab.com/whom/shs/stdlib" ) +/* creates new VarTable and FuncTable + * reads a configuration file + * executes contents and returns tables + */ func InitFromConfig(configFile string) (ast.VarTable, ast.FuncTable) { funcs := stdlib.GenFuncTable() vars := &map[string]*ast.Token{} diff --git a/log/logger.go b/log/logger.go index 5f3d773..2d736e6 100644 --- a/log/logger.go +++ b/log/logger.go @@ -29,16 +29,23 @@ const ( var logLevel int64 +/* Set the log level from 0 to 4 + * currently only 0, 1, and 2 are used. + */ func SetLogLvl(lvl int64) { if lvl < 4 && lvl > 0 { logLevel = lvl } } +/* get current log level as int + */ func GetLogLvl() int64 { return logLevel } +/* writes a message to the log + */ func Log(lvl int, msg, context string) { if int64(lvl) > logLevel { return diff --git a/util/scripts.go b/util/scripts.go index 310fd3e..3d2115b 100644 --- a/util/scripts.go +++ b/util/scripts.go @@ -24,6 +24,8 @@ import ( "gitlab.com/whom/shs/ast" ) +/* Opens a file and lexes+evaluates the contents + */ func LoadScript(path string, vt ast.VarTable, ft ast.FuncTable) { scriptFile, err := os.Open(path) if err != nil { diff --git a/util/shell_complete.go b/util/shell_complete.go index e2e4731..a6e3289 100644 --- a/util/shell_complete.go +++ b/util/shell_complete.go @@ -24,8 +24,10 @@ import ( "gitlab.com/whom/shs/ast" ) -// wrap this in a lambda that passes in the vt and ft -// I suppose it could be more optimal. Fix if it bothers you +/* gathers completions for the last word in a given line + * shell wraps this in a lambda that passes in the vt and ft + * I suppose it could be more optimal. Fix if it bothers you + */ func ShellCompleter(line string, vt ast.VarTable, ft ast.FuncTable) []string { var head, tail string