godoc for extra packages
This commit is contained in:
parent
fec3550702
commit
b941df68e1
4 changed files with 17 additions and 2 deletions
|
|
@ -24,6 +24,10 @@ import (
|
||||||
"gitlab.com/whom/shs/stdlib"
|
"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) {
|
func InitFromConfig(configFile string) (ast.VarTable, ast.FuncTable) {
|
||||||
funcs := stdlib.GenFuncTable()
|
funcs := stdlib.GenFuncTable()
|
||||||
vars := &map[string]*ast.Token{}
|
vars := &map[string]*ast.Token{}
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,23 @@ const (
|
||||||
|
|
||||||
var logLevel int64
|
var logLevel int64
|
||||||
|
|
||||||
|
/* Set the log level from 0 to 4
|
||||||
|
* currently only 0, 1, and 2 are used.
|
||||||
|
*/
|
||||||
func SetLogLvl(lvl int64) {
|
func SetLogLvl(lvl int64) {
|
||||||
if lvl < 4 && lvl > 0 {
|
if lvl < 4 && lvl > 0 {
|
||||||
logLevel = lvl
|
logLevel = lvl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get current log level as int
|
||||||
|
*/
|
||||||
func GetLogLvl() int64 {
|
func GetLogLvl() int64 {
|
||||||
return logLevel
|
return logLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* writes a message to the log
|
||||||
|
*/
|
||||||
func Log(lvl int, msg, context string) {
|
func Log(lvl int, msg, context string) {
|
||||||
if int64(lvl) > logLevel {
|
if int64(lvl) > logLevel {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ import (
|
||||||
"gitlab.com/whom/shs/ast"
|
"gitlab.com/whom/shs/ast"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* Opens a file and lexes+evaluates the contents
|
||||||
|
*/
|
||||||
func LoadScript(path string, vt ast.VarTable, ft ast.FuncTable) {
|
func LoadScript(path string, vt ast.VarTable, ft ast.FuncTable) {
|
||||||
scriptFile, err := os.Open(path)
|
scriptFile, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,10 @@ import (
|
||||||
"gitlab.com/whom/shs/ast"
|
"gitlab.com/whom/shs/ast"
|
||||||
)
|
)
|
||||||
|
|
||||||
// wrap this in a lambda that passes in the vt and ft
|
/* gathers completions for the last word in a given line
|
||||||
// I suppose it could be more optimal. Fix if it bothers you
|
* 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 {
|
func ShellCompleter(line string, vt ast.VarTable, ft ast.FuncTable) []string {
|
||||||
var head, tail string
|
var head, tail string
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue