diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index a402ef7d..df24a9c5 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -1,16 +1,18 @@ package main import ( + "encoding/json" "fmt" - "path/filepath" "go/ast" "go/doc" "go/parser" "go/token" + "os" + "path/filepath" "regexp" "strings" - "os" - "sync" + //"regexp" + //"sync" ) var header = `--- @@ -25,64 +27,65 @@ menu: ` type emmyPiece struct { - DocPiece *docPiece + DocPiece *docPiece Annotations []string - Params []string // we only need to know param name to put in function - FuncName string + Params []string // we only need to know param name to put in function + FuncName string } type module struct { - Types []docPiece - Docs []docPiece - Fields []docPiece - Properties []docPiece - ShortDescription string - Description string - ParentModule string - HasInterfaces bool - HasTypes bool + Name string `json:"name"` + ShortDescription string `json:"shortDescription"` + Description string `json:"description"` + ParentModule string `json:"parent,omitempty"` + HasInterfaces bool `json:"-"` + HasTypes bool `json:"-"` + Properties []docPiece `json:"properties"` + Fields []docPiece `json:"fields"` + Types []docPiece `json:"types,omitempty"` + Docs []docPiece `json:"docs"` + Interfaces map[string]module `json:"interfaces,omitempty"` } -type param struct{ +type param struct { Name string Type string - Doc []string + Doc []string } type docPiece struct { - Doc []string - FuncSig string - FuncName string - Interfacing string - ParentModule string - GoFuncName string - IsInterface bool - IsMember bool - IsType bool - Fields []docPiece - Properties []docPiece - Params []param - Tags map[string][]tag + FuncName string `json:"name"` + Doc []string `json:"description"` + ParentModule string `json:"parent,omitempty"` + Interfacing string `json:"interfaces,omitempty"` + FuncSig string `json:"signature,omitempty"` + GoFuncName string `json:"goFuncName,omitempty"` + IsInterface bool `json:"isInterface"` + IsMember bool `json:"isMember"` + IsType bool `json:"isType"` + Fields []docPiece `json:"fields,omitempty"` + Properties []docPiece `json:"properties,omitempty"` + Params []param `json:"params,omitempty"` + Tags map[string][]tag `json:"tags,omitempty"` } type tag struct { - id string - fields []string - startIdx int + Id string `json:"id"` + Fields []string `json:"fields"` + StartIdx int `json:"startIdx` } var docs = make(map[string]module) -var interfaceDocs = make(map[string]module) var emmyDocs = make(map[string][]emmyPiece) var typeTable = make(map[string][]string) // [0] = parentMod, [1] = interfaces var prefix = map[string]string{ - "main": "hl", - "hilbish": "hl", - "fs": "f", + "main": "hl", + "hilbish": "hl", + "fs": "f", "commander": "c", - "bait": "b", - "terminal": "term", - "snail": "snail", + "bait": "b", + "terminal": "term", + "snail": "snail", } func getTagsAndDocs(docs string) (map[string][]tag, []string) { @@ -99,17 +102,17 @@ func getTagsAndDocs(docs string) (map[string][]tag, []string) { id = tagParts[1] } tags[tagParts[0]] = []tag{ - {id: id, startIdx: idx}, + {Id: id, StartIdx: idx}, } if len(tagParts) >= 2 { - tags[tagParts[0]][0].fields = tagParts[2:] + tags[tagParts[0]][0].Fields = tagParts[2:] } } else { if tagParts[0] == "example" { - exampleIdx := tags["example"][0].startIdx - exampleCode := pts[exampleIdx+1:idx] + exampleIdx := tags["example"][0].StartIdx + exampleCode := pts[exampleIdx+1 : idx] - tags["example"][0].fields = exampleCode + tags["example"][0].Fields = exampleCode parts = strings.Split(strings.Replace(strings.Join(parts, "\n"), strings.TrimPrefix(strings.Join(exampleCode, "\n"), "#example\n"), "", -1), "\n") continue } @@ -119,8 +122,8 @@ func getTagsAndDocs(docs string) (map[string][]tag, []string) { fleds = tagParts[2:] } tags[tagParts[0]] = append(tags[tagParts[0]], tag{ - id: tagParts[1], - fields: fleds, + Id: tagParts[1], + Fields: fleds, }) } } else { @@ -135,8 +138,8 @@ func docPieceTag(tagName string, tags map[string][]tag) []docPiece { dps := []docPiece{} for _, tag := range tags[tagName] { dps = append(dps, docPiece{ - FuncName: tag.id, - Doc: tag.fields, + FuncName: tag.Id, + Doc: tag.Fields, }) } @@ -157,7 +160,7 @@ func setupDocType(mod string, typ *doc.Type) *docPiece { typeDoc := []string{} if inInterface { - interfaces = tags["interface"][0].id + interfaces = tags["interface"][0].Id } fields := docPieceTag("field", tags) @@ -167,16 +170,16 @@ func setupDocType(mod string, typ *doc.Type) *docPiece { if strings.HasPrefix(d, "---") { // TODO: document types in lua /* - emmyLine := strings.TrimSpace(strings.TrimPrefix(d, "---")) - emmyLinePieces := strings.Split(emmyLine, " ") - emmyType := emmyLinePieces[0] - if emmyType == "@param" { - em.Params = append(em.Params, emmyLinePieces[1]) - } - if emmyType == "@vararg" { - em.Params = append(em.Params, "...") // add vararg - } - em.Annotations = append(em.Annotations, d) + emmyLine := strings.TrimSpace(strings.TrimPrefix(d, "---")) + emmyLinePieces := strings.Split(emmyLine, " ") + emmyType := emmyLinePieces[0] + if emmyType == "@param" { + em.Params = append(em.Params, emmyLinePieces[1]) + } + if emmyType == "@vararg" { + em.Params = append(em.Params, "...") // add vararg + } + em.Annotations = append(em.Annotations, d) */ } else { typeDoc = append(typeDoc, d) @@ -189,16 +192,16 @@ func setupDocType(mod string, typ *doc.Type) *docPiece { } parentMod := mod dps := &docPiece{ - Doc: typeDoc, - FuncName: typeName, - Interfacing: interfaces, - IsInterface: inInterface, - IsMember: isMember, - IsType: true, + Doc: typeDoc, + FuncName: typeName, + Interfacing: interfaces, + IsInterface: inInterface, + IsMember: isMember, + IsType: true, ParentModule: parentMod, - Fields: fields, - Properties: properties, - Tags: tags, + Fields: fields, + Properties: properties, + Tags: tags, } typeTable[strings.ToLower(typeName)] = []string{parentMod, interfaces} @@ -232,7 +235,7 @@ start: funcdoc := []string{} if inInterface { - interfaces = tags["interface"][0].id + interfaces = tags["interface"][0].Id funcName = interfaces + "." + strings.Split(funcsig, "(")[0] } em := emmyPiece{FuncName: funcName} @@ -244,9 +247,9 @@ start: params = make([]param, len(paramsRaw)) for i, p := range paramsRaw { params[i] = param{ - Name: p.id, - Type: p.fields[0], - Doc: p.fields[1:], + Name: p.Id, + Type: p.Fields[0], + Doc: p.Fields[1:], } } } @@ -277,105 +280,69 @@ start: parentMod = mod } dps := &docPiece{ - Doc: funcdoc, - FuncSig: funcsig, - FuncName: funcName, - Interfacing: interfaces, - GoFuncName: strings.ToLower(fun.Name), - IsInterface: inInterface, - IsMember: isMember, + Doc: funcdoc, + FuncSig: funcsig, + FuncName: funcName, + Interfacing: interfaces, + GoFuncName: strings.ToLower(fun.Name), + IsInterface: inInterface, + IsMember: isMember, ParentModule: parentMod, - Fields: fields, - Properties: properties, - Params: params, - Tags: tags, + Fields: fields, + Properties: properties, + Params: params, + Tags: tags, } if strings.HasSuffix(dps.GoFuncName, strings.ToLower("loader")) { dps.Doc = parts } em.DocPiece = dps - + emmyDocs[mod] = append(emmyDocs[mod], em) return dps } func main() { - fset := token.NewFileSet() - os.Mkdir("docs", 0777) - os.RemoveAll("docs/api") - os.Mkdir("docs/api", 0777) + if len(os.Args) == 1 { + fset := token.NewFileSet() + os.Mkdir("defs", 0777) + /* + os.Mkdir("emmyLuaDocs", 0777) + */ - f, err := os.Create("docs/api/_index.md") - if err != nil { - panic(err) - } - f.WriteString(`--- -title: API -layout: doc -weight: -100 -menu: docs ---- - -Welcome to the API documentation for Hilbish. This documents Lua functions -provided by Hilbish. -`) - f.Close() - - os.Mkdir("emmyLuaDocs", 0777) - - dirs := []string{"./", "./util"} - filepath.Walk("golibs/", func (path string, info os.FileInfo, err error) error { - if !info.IsDir() { + dirs := []string{"./", "./util"} + filepath.Walk("golibs/", func(path string, info os.FileInfo, err error) error { + if !info.IsDir() { + return nil + } + dirs = append(dirs, "./"+path) return nil - } - dirs = append(dirs, "./" + path) - return nil - }) + }) - pkgs := make(map[string]*ast.Package) - for _, path := range dirs { - d, err := parser.ParseDir(fset, path, nil, parser.ParseComments) - if err != nil { - fmt.Println(err) - return - } - for k, v := range d { - pkgs[k] = v - } - } - - interfaceModules := make(map[string]*module) - for l, f := range pkgs { - p := doc.New(f, "./", doc.AllDecls) - pieces := []docPiece{} - typePieces := []docPiece{} - mod := l - if mod == "main" || mod == "util" { - mod = "hilbish" - } - var hasInterfaces bool - for _, t := range p.Funcs { - piece := setupDoc(mod, t) - if piece == nil { - continue + pkgs := make(map[string]*ast.Package) + for _, path := range dirs { + d, err := parser.ParseDir(fset, path, nil, parser.ParseComments) + if err != nil { + fmt.Println(err) + return } - - pieces = append(pieces, *piece) - if piece.IsInterface { - hasInterfaces = true + for k, v := range d { + pkgs[k] = v } } - for _, t := range p.Types { - typePiece := setupDocType(mod, t) - if typePiece != nil { - typePieces = append(typePieces, *typePiece) - if typePiece.IsInterface { - hasInterfaces = true - } - } - for _, m := range t.Methods { - piece := setupDoc(mod, m) + interfaceModules := make(map[string]*module) + for l, f := range pkgs { + p := doc.New(f, "./", doc.AllDecls) + pieces := []docPiece{} + typePieces := []docPiece{} + mod := l + if mod == "main" || mod == "util" { + mod = "hilbish" + } + var hasInterfaces bool + for _, t := range p.Funcs { + piece := setupDoc(mod, t) if piece == nil { continue } @@ -385,105 +352,259 @@ provided by Hilbish. hasInterfaces = true } } - } + for _, t := range p.Types { + typePiece := setupDocType(mod, t) + if typePiece != nil { + typePieces = append(typePieces, *typePiece) + if typePiece.IsInterface { + hasInterfaces = true + } + } - tags, descParts := getTagsAndDocs(strings.TrimSpace(p.Doc)) - shortDesc := descParts[0] - desc := descParts[1:] - filteredPieces := []docPiece{} - filteredTypePieces := []docPiece{} - for _, piece := range pieces { - if !piece.IsInterface { - filteredPieces = append(filteredPieces, piece) - continue - } + for _, m := range t.Methods { + piece := setupDoc(mod, m) + if piece == nil { + continue + } - modname := piece.ParentModule + "." + piece.Interfacing - if interfaceModules[modname] == nil { - interfaceModules[modname] = &module{ - ParentModule: piece.ParentModule, + pieces = append(pieces, *piece) + if piece.IsInterface { + hasInterfaces = true + } } } - if strings.HasSuffix(piece.GoFuncName, strings.ToLower("loader")) { - shortDesc := piece.Doc[0] - desc := piece.Doc[1:] - interfaceModules[modname].ShortDescription = shortDesc - interfaceModules[modname].Description = strings.Join(desc, "\n") - interfaceModules[modname].Fields = piece.Fields - interfaceModules[modname].Properties = piece.Properties - continue + tags, descParts := getTagsAndDocs(strings.TrimSpace(p.Doc)) + shortDesc := descParts[0] + desc := descParts[1:] + filteredPieces := []docPiece{} + filteredTypePieces := []docPiece{} + for _, piece := range pieces { + if !piece.IsInterface { + filteredPieces = append(filteredPieces, piece) + continue + } + + modname := piece.ParentModule + "." + piece.Interfacing + if interfaceModules[modname] == nil { + interfaceModules[modname] = &module{ + Name: modname, + ParentModule: piece.ParentModule, + } + } + + if strings.HasSuffix(piece.GoFuncName, strings.ToLower("loader")) { + shortDesc := piece.Doc[0] + desc := piece.Doc[1:] + interfaceModules[modname].ShortDescription = shortDesc + interfaceModules[modname].Description = strings.Join(desc, "\n") + interfaceModules[modname].Fields = piece.Fields + interfaceModules[modname].Properties = piece.Properties + continue + } + + interfaceModules[modname].Docs = append(interfaceModules[modname].Docs, piece) } - interfaceModules[modname].Docs = append(interfaceModules[modname].Docs, piece) - } + for _, piece := range typePieces { + if !piece.IsInterface { + filteredTypePieces = append(filteredTypePieces, piece) + continue + } - for _, piece := range typePieces { - if !piece.IsInterface { - filteredTypePieces = append(filteredTypePieces, piece) - continue + modname := piece.ParentModule + "." + piece.Interfacing + if interfaceModules[modname] == nil { + interfaceModules[modname] = &module{ + ParentModule: piece.ParentModule, + } + } + + interfaceModules[modname].Types = append(interfaceModules[modname].Types, piece) } - modname := piece.ParentModule + "." + piece.Interfacing - if interfaceModules[modname] == nil { - interfaceModules[modname] = &module{ - ParentModule: piece.ParentModule, + fmt.Println(filteredTypePieces) + if newDoc, ok := docs[mod]; ok { + oldMod := docs[mod] + newDoc.Types = append(filteredTypePieces, oldMod.Types...) + newDoc.Docs = append(filteredPieces, oldMod.Docs...) + + docs[mod] = newDoc + } else { + docs[mod] = module{ + Name: mod, + Types: filteredTypePieces, + Docs: filteredPieces, + ShortDescription: shortDesc, + Description: strings.Join(desc, "\n"), + HasInterfaces: hasInterfaces, + Properties: docPieceTag("property", tags), + Fields: docPieceTag("field", tags), + Interfaces: make(map[string]module), } } - - interfaceModules[modname].Types = append(interfaceModules[modname].Types, piece) } - fmt.Println(filteredTypePieces) - if newDoc, ok := docs[mod]; ok { - oldMod := docs[mod] - newDoc.Types = append(filteredTypePieces, oldMod.Types...) - newDoc.Docs = append(filteredPieces, oldMod.Docs...) + for key, mod := range interfaceModules { + fmt.Println(key, mod.ParentModule) + parentMod := docs[mod.ParentModule] + parentMod.Interfaces[key] = *mod + } - docs[mod] = newDoc - } else { - docs[mod] = module{ - Types: filteredTypePieces, - Docs: filteredPieces, - ShortDescription: shortDesc, - Description: strings.Join(desc, "\n"), - HasInterfaces: hasInterfaces, - Properties: docPieceTag("property", tags), - Fields: docPieceTag("field", tags), + //var wg sync.WaitGroup + //wg.Add(len(docs) * 2) + + for mod, v := range docs { + u, err := json.MarshalIndent(v, "", " ") + if err != nil { + panic(err) } + + fmt.Println(mod) + f, err := os.Create("defs/" + mod + ".json") + if err != nil { + panic(err) + } + f.WriteString(string(u)) + } + //wg.Wait() + } else if os.Args[1] == "md" { + fmt.Println("Generating MD files from Hilbish doc defs!") + os.Mkdir("docs", 0777) + os.RemoveAll("docs/api") + os.Mkdir("docs/api", 0777) + + f, err := os.Create("docs/api/_index.md") + if err != nil { + panic(err) + } + f.WriteString(`--- +title: API +layout: doc +weight: -100 +menu: docs +--- + +Welcome to the API documentation for Hilbish. This documents Lua functions +provided by Hilbish. +`) + f.Close() + + defs, err := os.ReadDir("defs") + if err != nil { + panic(err) + } + + for _, defEntry := range defs { + defContent, err := os.ReadFile(filepath.Join(".", "defs", defEntry.Name())) + if err != nil { + panic(err) + } + + var def module + err = json.Unmarshal(defContent, &def) + if err != nil { + panic(err) + } + + generateFile(def) } } +} - for key, mod := range interfaceModules { - docs[key] = *mod +func generateFile(v module) { + mod := v.Name + docPath := "docs/api/" + mod + ".md" + if v.HasInterfaces { + os.Mkdir("docs/api/"+mod, 0777) + os.Remove(docPath) // remove old doc path if it exists + docPath = "docs/api/" + mod + "/_index.md" + } + if v.ParentModule != "" { + docPath = "docs/api/" + v.ParentModule + "/" + mod + ".md" } - var wg sync.WaitGroup - wg.Add(len(docs) * 2) + modOrIface := "Module" + if v.ParentModule != "" { + modOrIface = "Module" + } + lastHeader := "" - for mod, v := range docs { - docPath := "docs/api/" + mod + ".md" - if v.HasInterfaces { - os.Mkdir("docs/api/" + mod, 0777) - os.Remove(docPath) // remove old doc path if it exists - docPath = "docs/api/" + mod + "/_index.md" + f, _ := os.Create(docPath) + f.WriteString(fmt.Sprintf(header, modOrIface, mod, v.ShortDescription)) + typeTag, _ := regexp.Compile(`\B@\w+`) + /*modDescription := typeTag.ReplaceAllStringFunc(strings.Replace(strings.Replace(v.Description, "<", `\<`, -1), "{{\\<", "{{<", -1), func(typ string) string { + typName := typ[1:] + typLookup := typeTable[strings.ToLower(typName)] + ifaces := typLookup[0] + "." + typLookup[1] + "/" + if typLookup[1] == "" { + ifaces = "" } - if v.ParentModule != "" { - docPath = "docs/api/" + v.ParentModule + "/" + mod + ".md" - } - - go func(modname, docPath string, modu module) { - defer wg.Done() - modOrIface := "Module" - if modu.ParentModule != "" { - modOrIface = "Module" + linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s#%s", typLookup[0], ifaces, strings.ToLower(typName)) + return fmt.Sprintf(`%s`, linkedTyp, typName) + })*/ + modDescription := v.Description + f.WriteString(heading("Introduction", 2)) + f.WriteString(modDescription) + f.WriteString("\n\n") + if len(v.Docs) != 0 { + funcCount := 0 + for _, dps := range v.Docs { + if dps.IsMember { + continue } - lastHeader := "" + funcCount++ + } - f, _ := os.Create(docPath) - f.WriteString(fmt.Sprintf(header, modOrIface, modname, modu.ShortDescription)) - typeTag, _ := regexp.Compile(`\B@\w+`) - modDescription := typeTag.ReplaceAllStringFunc(strings.Replace(strings.Replace(modu.Description, "<", `\<`, -1), "{{\\<", "{{<", -1), func(typ string) string { + f.WriteString(heading("Functions", 2)) + //lastHeader = "functions" + + diff := 0 + funcTable := [][]string{} + for _, dps := range v.Docs { + if dps.IsMember { + diff++ + continue + } + + if len(dps.Doc) == 0 { + fmt.Printf("WARNING! Function %s on module %s has no documentation!\n", dps.FuncName, mod) + } else { + funcTable = append(funcTable, []string{fmt.Sprintf(`%s`, dps.FuncName, dps.FuncSig), dps.Doc[0]}) + } + } + f.WriteString(table(funcTable)) + } + + if len(v.Fields) != 0 { + f.WriteString(heading("Static module fields", 2)) + + fieldsTable := [][]string{} + for _, dps := range v.Fields { + fieldsTable = append(fieldsTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) + } + f.WriteString(table(fieldsTable)) + } + if len(v.Properties) != 0 { + f.WriteString(heading("Object properties", 2)) + + propertiesTable := [][]string{} + for _, dps := range v.Properties { + propertiesTable = append(propertiesTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) + } + f.WriteString(table(propertiesTable)) + } + + if len(v.Docs) != 0 { + if lastHeader != "functions" { + f.WriteString(heading("Functions", 2)) + } + for _, dps := range v.Docs { + if dps.IsMember { + continue + } + f.WriteString("``` =html\n") + f.WriteString(fmt.Sprintf("
\n
", dps.FuncName)) + htmlSig := strings.Replace(mod+"."+dps.FuncSig, "<", `\<`, -1) /*typeTag.ReplaceAllStringFunc(strings.Replace(mod+"."+dps.FuncSig, "<", `\<`, -1), func(typ string) string { typName := typ[1:] typLookup := typeTable[strings.ToLower(typName)] ifaces := typLookup[0] + "." + typLookup[1] + "/" @@ -491,80 +612,10 @@ provided by Hilbish. ifaces = "" } linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s#%s", typLookup[0], ifaces, strings.ToLower(typName)) - return fmt.Sprintf(`%s`, linkedTyp, typName) - }) - f.WriteString(heading("Introduction", 2)) - f.WriteString(modDescription) - f.WriteString("\n\n") - if len(modu.Docs) != 0 { - funcCount := 0 - for _, dps := range modu.Docs { - if dps.IsMember { - continue - } - funcCount++ - } - - f.WriteString(heading("Functions", 2)) - lastHeader = "functions" - - diff := 0 - funcTable := [][]string{} - for _, dps := range modu.Docs { - if dps.IsMember { - diff++ - continue - } - - if len(dps.Doc) == 0 { - fmt.Printf("WARNING! Function %s on module %s has no documentation!\n", dps.FuncName, modname) - } else { - funcTable = append(funcTable, []string{fmt.Sprintf(`%s`, dps.FuncName, dps.FuncSig), dps.Doc[0]}) - } - } - f.WriteString(table(funcTable)) - } - - if len(modu.Fields) != 0 { - f.WriteString(heading("Static module fields", 2)) - - fieldsTable := [][]string{} - for _, dps := range modu.Fields { - fieldsTable = append(fieldsTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) - } - f.WriteString(table(fieldsTable)) - } - if len(modu.Properties) != 0 { - f.WriteString(heading("Object properties", 2)) - - propertiesTable := [][]string{} - for _, dps := range modu.Properties { - propertiesTable = append(propertiesTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) - } - f.WriteString(table(propertiesTable)) - } - - if len(modu.Docs) != 0 { - if lastHeader != "functions" { - f.WriteString(heading("Functions", 2)) - } - for _, dps := range modu.Docs { - if dps.IsMember { - continue - } - f.WriteString(fmt.Sprintf("
\n
", dps.FuncName)) - htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(modname + "." + dps.FuncSig, "<", `\<`, -1), func(typ string) string { - typName := typ[1:] - typLookup := typeTable[strings.ToLower(typName)] - ifaces := typLookup[0] + "." + typLookup[1] + "/" - if typLookup[1] == "" { - ifaces = "" - } - linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s#%s", typLookup[0], ifaces, strings.ToLower(typName)) - return fmt.Sprintf(`%s`, linkedTyp, typName) - }) - f.WriteString(fmt.Sprintf(` -

+ return fmt.Sprintf(`%s`, linkedTyp, typName) + })*/ + f.WriteString(fmt.Sprintf(` +

%s @@ -572,121 +623,85 @@ provided by Hilbish.

`, htmlSig, dps.FuncName)) - for _, doc := range dps.Doc { - if !strings.HasPrefix(doc, "---") && doc != "" { - f.WriteString(doc + " \n") - } - } - f.WriteString("\n") - f.WriteString(heading("Parameters", 4)) - if len(dps.Params) == 0 { - f.WriteString("This function has no parameters. \n") - } - for _, p := range dps.Params { - isVariadic := false - typ := p.Type - if strings.HasPrefix(p.Type, "...") { - isVariadic = true - typ = p.Type[3:] - } + f.WriteString("```\n\n") - f.WriteString(fmt.Sprintf("`%s` *`%s`*", typ, p.Name)) - if isVariadic { - f.WriteString(" (This type is variadic. You can pass an infinite amount of parameters with this type.)") - } - f.WriteString(" \n") - f.WriteString(strings.Join(p.Doc, " ")) - f.WriteString("\n\n") - } - if codeExample := dps.Tags["example"]; codeExample != nil { - f.WriteString(heading("Example", 4)) - f.WriteString(fmt.Sprintf("```lua\n%s\n```\n", strings.Join(codeExample[0].fields, "\n"))) - } - f.WriteString("
") - f.WriteString("\n\n") + for _, doc := range dps.Doc { + if !strings.HasPrefix(doc, "---") && doc != "" { + f.WriteString(doc + " \n") } } + f.WriteString("\n") + f.WriteString(heading("Parameters", 4)) + if len(dps.Params) == 0 { + f.WriteString("This function has no parameters. \n") + } + for _, p := range dps.Params { + isVariadic := false + typ := p.Type + if strings.HasPrefix(p.Type, "...") { + isVariadic = true + typ = p.Type[3:] + } - if len(modu.Types) != 0 { - f.WriteString(heading("Types", 2)) - for _, dps := range modu.Types { - f.WriteString("
\n\n") - f.WriteString(heading(dps.FuncName, 2)) - for _, doc := range dps.Doc { - if !strings.HasPrefix(doc, "---") { - f.WriteString(doc + "\n") - } - } - if len(dps.Properties) != 0 { - f.WriteString(heading("Object Properties", 2)) + f.WriteString(fmt.Sprintf("`%s` `*%s*`", typ, p.Name)) + if isVariadic { + f.WriteString(" (This type is variadic. You can pass an infinite amount of parameters with this type.)") + } + f.WriteString(" \n") + f.WriteString(strings.Join(p.Doc, " ")) + f.WriteString("\n\n") + } + if codeExample := dps.Tags["example"]; codeExample != nil { + f.WriteString(heading("Example", 4)) + f.WriteString(fmt.Sprintf("```lua\n%s\n```\n", strings.Join(codeExample[0].Fields, "\n"))) + } + f.WriteString("\n\n") + } + } - propertiesTable := [][]string{} - for _, dps := range modu.Properties { - propertiesTable = append(propertiesTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) - } - f.WriteString(table(propertiesTable)) - } - f.WriteString("\n") - f.WriteString(heading("Methods", 3)) - for _, dps := range modu.Docs { - if !dps.IsMember { - continue - } - htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(dps.FuncSig, "<", `\<`, -1), func(typ string) string { - typName := regexp.MustCompile(`\w+`).FindString(typ[1:]) - typLookup := typeTable[strings.ToLower(typName)] - fmt.Printf("%+q, \n", typLookup) - linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s/#%s", typLookup[0], typLookup[0] + "." + typLookup[1], strings.ToLower(typName)) - return fmt.Sprintf(`
%s`, linkedTyp, typName) - }) - //f.WriteString(fmt.Sprintf("#### %s\n", htmlSig)) - f.WriteString(heading(htmlSig, 4)) - for _, doc := range dps.Doc { - if !strings.HasPrefix(doc, "---") { - f.WriteString(doc + "\n") - } - } - f.WriteString("\n") - } + if len(v.Types) != 0 { + f.WriteString(heading("Types", 2)) + for _, dps := range v.Types { + f.WriteString("``` =html\n
\n```\n\n") + f.WriteString(heading(dps.FuncName, 2)) + for _, doc := range dps.Doc { + if !strings.HasPrefix(doc, "---") { + f.WriteString(doc + "\n") } } - }(mod, docPath, v) + if len(dps.Properties) != 0 { + f.WriteString(heading("Object Properties", 2)) - go func(md, modname string, modu module) { - defer wg.Done() - - if modu.ParentModule != "" { - return + propertiesTable := [][]string{} + for _, dps := range v.Properties { + propertiesTable = append(propertiesTable, []string{dps.FuncName, strings.Join(dps.Doc, " ")}) + } + f.WriteString(table(propertiesTable)) } - - ff, _ := os.Create("emmyLuaDocs/" + modname + ".lua") - ff.WriteString("--- @meta\n\nlocal " + modname + " = {}\n\n") - for _, em := range emmyDocs[modname] { - if strings.HasSuffix(em.DocPiece.GoFuncName, strings.ToLower("loader")) { + f.WriteString("\n") + f.WriteString(heading("Methods", 3)) + for _, dps := range v.Docs { + if !dps.IsMember { continue } - - dps := em.DocPiece - funcdocs := dps.Doc - ff.WriteString("--- " + strings.Join(funcdocs, "\n--- ") + "\n") - if len(em.Annotations) != 0 { - ff.WriteString(strings.Join(em.Annotations, "\n") + "\n") + htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(dps.FuncSig, "<", `\<`, -1), func(typ string) string { + typName := regexp.MustCompile(`\w+`).FindString(typ[1:]) + typLookup := typeTable[strings.ToLower(typName)] + fmt.Printf("%+q, \n", typLookup) + linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s/#%s", typLookup[0], typLookup[0]+"."+typLookup[1], strings.ToLower(typName)) + return fmt.Sprintf(`%s`, linkedTyp, typName) + }) + //f.WriteString(fmt.Sprintf("#### %s\n", htmlSig)) + f.WriteString(heading(htmlSig, 4)) + for _, doc := range dps.Doc { + if !strings.HasPrefix(doc, "---") { + f.WriteString(doc + "\n") + } } - accessor := "." - if dps.IsMember { - accessor = ":" - } - signature := strings.Split(dps.FuncSig, " ->")[0] - var intrface string - if dps.IsInterface { - intrface = "." + dps.Interfacing - } - ff.WriteString("function " + modname + intrface + accessor + signature + " end\n\n") + f.WriteString("\n") } - ff.WriteString("return " + modname + "\n") - }(mod, mod, v) + } } - wg.Wait() } func heading(name string, level int) string { @@ -696,13 +711,13 @@ func heading(name string, level int) string { func table(elems [][]string) string { var b strings.Builder b.WriteString("``` =html\n") - b.WriteString("
\n") - b.WriteString("\n") + b.WriteString("
\n") + b.WriteString("
\n") b.WriteString("\n") for _, line := range elems { - b.WriteString("\n") + b.WriteString("\n") for _, col := range line { - b.WriteString("\n") } diff --git a/cmd/docgen/docgen.lua b/cmd/docgen/docgen.lua index 073456b0..8c9b63ce 100644 --- a/cmd/docgen/docgen.lua +++ b/cmd/docgen/docgen.lua @@ -110,7 +110,7 @@ menu: ]] for iface, dps in pairs(pieces) do - local mod = iface:match '(%w+)%.' or 'nature' + local mod = iface ~= 'nature' and iface:match '(%w+)' or 'nature' local docParent = 'Nature' path = string.format('docs/%s/%s.md', mod, iface) @@ -128,100 +128,21 @@ for iface, dps in pairs(pieces) do local exists = pcall(fs.stat, path) local newOrNotNature = (exists and mod ~= 'nature') or iface == 'hilbish' - local f = io.open(path, newOrNotNature and 'r+' or 'w+') - local tocPos + --local f = io.open(path, newOrNotNature and 'r+' or 'w+') if not newOrNotNature then - f:write(string.format(header, 'Module', iface, (descriptions[iface] and #descriptions[iface] > 0) and descriptions[iface][1] or 'No description.', docParent)) + --f:write(string.format(header, 'Module', iface, (descriptions[iface] and #descriptions[iface] > 0) and descriptions[iface][1] or 'No description.', docParent)) if descriptions[iface] and #descriptions[iface] > 0 then table.remove(descriptions[iface], 1) - f:write(string.format('\n## Introduction\n%s\n\n', table.concat(descriptions[iface], '\n'))) - f:write('## Functions\n') - f:write([[||| -|----|----| -]]) - tocPos = f:seek() - end - end - - local tocSearch = false - for line in f:lines() do - if line:match '^## Functions' then - tocSearch = true - end - if tocSearch and line == '' then - tocSearch = false - tocPos = f:seek() - 1 + --f:write(string.format('\n## Introduction\n%s\n\n', table.concat(descriptions[iface], '\n'))) + --f:write('## Functions\n') end end + print(mod, dps) table.sort(dps, function(a, b) return a[1] < b[1] end) - for _, piece in pairs(dps) do + --[[for _, piece in pairs(dps) do local func = piece[1] local docs = piece[2] - local sig = string.format('%s.%s(', iface, func) - local params = '' - for idx, param in ipairs(docs.params) do - sig = sig .. param.name:gsub('%?$', '') - params = params .. param.name:gsub('%?$', '') - if idx ~= #docs.params then - sig = sig .. ', ' - params = params .. ', ' - end - end - sig = sig .. ')' - - if tocPos then - f:seek('set', tocPos) - local contents = f:read '*a' - f:seek('set', tocPos) - local tocLine = string.format('|%s|%s|\n', func, string.format('%s(%s)', func, params), docs.description[1]) - f:write(tocLine .. contents) - f:seek 'end' - end - - f:write(string.format('
\n
\n', func)) - f:write(string.format([[ -

-%s - - - -

- -]], sig, func)) - - f:write(table.concat(docs.description, '\n') .. '\n') - f:write '#### Parameters\n' - if #docs.params == 0 then - f:write 'This function has no parameters. \n' - end - for _, param in ipairs(docs.params) do - f:write(string.format('`%s` **`%s`** \n', param.name:gsub('%?$', ''), param.type)) - f:write(string.format('%s\n\n', param.description)) - end - if #docs.example ~= 0 then - f:write '#### Example\n' - f:write(string.format('```lua\n%s\n```\n', table.concat(docs.example, '\n'))) - end - --[[ - local params = table.filter(docs, function(t) - return t:match '^%-%-%- @param' - end) - for i, str in ipairs(params) do - if i ~= 1 then - f:write ', ' - end - f:write(str:match '^%-%-%- @param ([%w]+) ') - end - f:write(')\n') - - for _, str in ipairs(docs) do - if not str:match '^%-%-%- @' then - f:write(str:match '^%-%-%- (.+)' .. '\n') - end - end - ]]-- - f:write('
') - f:write('\n\n') - end + print(func, docs) + end]] end diff --git a/defs/bait.json b/defs/bait.json new file mode 100644 index 00000000..69715be3 --- /dev/null +++ b/defs/bait.json @@ -0,0 +1,388 @@ +{ + "name": "bait", + "shortDescription": "the event emitter", + "description": "\nBait is the event emitter for Hilbish. Much like Node.js and\nits `events` system, many actions in Hilbish emit events.\nUnlike Node.js, Hilbish events are global. So make sure to\npick a unique name!\n\nUsage of the Bait module consists of userstanding\nevent-driven architecture, but it's pretty simple:\nIf you want to act on a certain event, you can `catch` it.\nYou can act on events via callback functions.\n\nExamples of this are in the Hilbish default config!\nConsider this part of it:\n```lua\nbait.catch('command.exit', function(code)\n\trunning = false\n\tdoPrompt(code ~= 0)\n\tdoNotifyPrompt()\nend)\n```\n\nWhat this does is, whenever the `command.exit` event is thrown,\nthis function will set the user prompt.", + "properties": [], + "fields": [], + "docs": [ + { + "name": "catch", + "description": [ + "Catches an event. This function can be used to act on events.", + "", + "" + ], + "signature": "catch(name, cb)", + "goFuncName": "bcatch", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "The", + "name", + "of", + "the", + "hook." + ] + }, + { + "Name": "cb", + "Type": "function", + "Doc": [ + "The", + "function", + "that", + "will", + "be", + "called", + "when", + "the", + "hook", + "is", + "thrown." + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "bait.catch('hilbish.exit', function()", + "\tprint 'Goodbye Hilbish!'", + "end)" + ], + "StartIdx": 5 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string", + "The", + "name", + "of", + "the", + "hook." + ], + "StartIdx": 2 + }, + { + "id": "cb", + "fields": [ + "function", + "The", + "function", + "that", + "will", + "be", + "called", + "when", + "the", + "hook", + "is", + "thrown." + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "catchOnce", + "description": [ + "Catches an event, but only once. This will remove the hook immediately after it runs for the first time." + ], + "signature": "catchOnce(name, cb)", + "goFuncName": "bcatchonce", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "The", + "name", + "of", + "the", + "event" + ] + }, + { + "Name": "cb", + "Type": "function", + "Doc": [ + "The", + "function", + "that", + "will", + "be", + "called", + "when", + "the", + "event", + "is", + "thrown." + ] + } + ], + "tags": { + "param": [ + { + "id": "name", + "fields": [ + "string", + "The", + "name", + "of", + "the", + "event" + ], + "StartIdx": 2 + }, + { + "id": "cb", + "fields": [ + "function", + "The", + "function", + "that", + "will", + "be", + "called", + "when", + "the", + "event", + "is", + "thrown." + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "hooks", + "description": [ + "Returns a table of functions that are hooked on an event with the corresponding `name`." + ], + "signature": "hooks(name) -\u003e table", + "goFuncName": "bhooks", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "The", + "name", + "of", + "the", + "hook" + ] + } + ], + "tags": { + "param": [ + { + "id": "name", + "fields": [ + "string", + "The", + "name", + "of", + "the", + "hook" + ], + "StartIdx": 2 + } + ], + "returns": [ + { + "id": "table\u003cfunction\u003e", + "fields": [], + "StartIdx": 3 + } + ] + } + }, + { + "name": "release", + "description": [ + "Removes the `catcher` for the event with `name`.", + "For this to work, `catcher` has to be the same function used to catch", + "an event, like one saved to a variable.", + "", + "" + ], + "signature": "release(name, catcher)", + "goFuncName": "brelease", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "Name", + "of", + "the", + "event", + "the", + "hook", + "is", + "on" + ] + }, + { + "Name": "catcher", + "Type": "function", + "Doc": [ + "Hook", + "function", + "to", + "remove" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "local hookCallback = function() print 'hi' end", + "", + "bait.catch('event', hookCallback)", + "", + "-- a little while later....", + "bait.release('event', hookCallback)", + "-- and now hookCallback will no longer be ran for the event." + ], + "StartIdx": 7 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string", + "Name", + "of", + "the", + "event", + "the", + "hook", + "is", + "on" + ], + "StartIdx": 4 + }, + { + "id": "catcher", + "fields": [ + "function", + "Hook", + "function", + "to", + "remove" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "throw", + "description": [ + "Throws a hook with `name` with the provided `args`.", + "", + "" + ], + "signature": "throw(name, ...args)", + "goFuncName": "bthrow", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "The", + "name", + "of", + "the", + "hook." + ] + }, + { + "Name": "args", + "Type": "...any", + "Doc": [ + "The", + "arguments", + "to", + "pass", + "to", + "the", + "hook." + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "bait.throw('greeting', 'world')", + "", + "-- This can then be listened to via", + "bait.catch('gretting', function(greetTo)", + "\tprint('Hello ' .. greetTo)", + "end)" + ], + "StartIdx": 5 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string", + "The", + "name", + "of", + "the", + "hook." + ], + "StartIdx": 1 + }, + { + "id": "args", + "fields": [ + "...any", + "The", + "arguments", + "to", + "pass", + "to", + "the", + "hook." + ], + "StartIdx": 0 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/defs/commander.json b/defs/commander.json new file mode 100644 index 00000000..cc44cb5b --- /dev/null +++ b/defs/commander.json @@ -0,0 +1,152 @@ +{ + "name": "commander", + "shortDescription": "library for custom commands", + "description": "\nCommander is the library which handles Hilbish commands. This makes\nthe user able to add Lua-written commands to their shell without making\na separate script in a bin folder. Instead, you may simply use the Commander\nlibrary in your Hilbish config.\n\n```lua\nlocal commander = require 'commander'\n\ncommander.register('hello', function(args, sinks)\n\tsinks.out:writeln 'Hello world!'\nend)\n```\n\nIn this example, a command with the name of `hello` is created\nthat will print `Hello world!` to output. One question you may\nhave is: What is the `sinks` parameter?\n\nThe `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`.\nThere is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`)\nas `in` is also a Lua keyword, so `input` is preferred for use.\nAll of them are a @Sink.\nIn the future, `sinks.in` will be removed.\n\n- `in` is the standard input.\nYou may use the read functions on this sink to get input from the user.\n- `out` is standard output.\nThis is usually where command output should go.\n- `err` is standard error.\nThis sink is for writing errors, as the name would suggest.", + "properties": [], + "fields": [], + "docs": [ + { + "name": "deregister", + "description": [ + "Removes the named command. Note that this will only remove Commander-registered commands." + ], + "signature": "deregister(name)", + "goFuncName": "cderegister", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "Name", + "of", + "the", + "command", + "to", + "remove." + ] + } + ], + "tags": { + "param": [ + { + "id": "name", + "fields": [ + "string", + "Name", + "of", + "the", + "command", + "to", + "remove." + ], + "StartIdx": 2 + } + ] + } + }, + { + "name": "register", + "description": [ + "Adds a new command with the given `name`. When Hilbish has to run a command with a name,", + "it will run the function providing the arguments and sinks.", + "", + "" + ], + "signature": "register(name, cb)", + "goFuncName": "cregister", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "Name", + "of", + "the", + "command" + ] + }, + { + "Name": "cb", + "Type": "function", + "Doc": [ + "Callback", + "to", + "handle", + "command", + "invocation" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- When you run the command `hello` in the shell, it will print `Hello world`.", + "-- If you run it with, for example, `hello Hilbish`, it will print 'Hello Hilbish'", + "commander.register('hello', function(args, sinks)", + "\tlocal name = 'world'", + "\tif #args \u003e 0 then name = args[1] end", + "", + "\tsinks.out:writeln('Hello ' .. name)", + "end)" + ], + "StartIdx": 6 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string", + "Name", + "of", + "the", + "command" + ], + "StartIdx": 3 + }, + { + "id": "cb", + "fields": [ + "function", + "Callback", + "to", + "handle", + "command", + "invocation" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "registry", + "description": [ + "Returns all registered commanders. Returns a list of tables with the following keys:", + "- `exec`: The function used to run the commander. Commanders require args and sinks to be passed." + ], + "signature": "registry() -\u003e table", + "goFuncName": "cregistry", + "isInterface": false, + "isMember": false, + "isType": false, + "tags": { + "returns": [ + { + "id": "table", + "fields": [], + "StartIdx": 3 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/defs/fs.json b/defs/fs.json new file mode 100644 index 00000000..3ea92f8e --- /dev/null +++ b/defs/fs.json @@ -0,0 +1,549 @@ +{ + "name": "fs", + "shortDescription": "filesystem interaction and functionality library", + "description": "\nThe fs module provides filesystem functions to Hilbish. While Lua's standard\nlibrary has some I/O functions, they're missing a lot of the basics. The `fs`\nlibrary offers more functions and will work on any operating system Hilbish does.", + "properties": [], + "fields": [ + { + "name": "pathSep", + "description": [ + "The", + "operating", + "system's", + "path", + "separator." + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "docs": [ + { + "name": "abs", + "description": [ + "Returns an absolute version of the `path`.", + "This can be used to resolve short paths like `..` to `/home/user`." + ], + "signature": "abs(path) -\u003e string", + "goFuncName": "fabs", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "path", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 4 + } + ] + } + }, + { + "name": "basename", + "description": [ + "Returns the \"basename,\" or the last part of the provided `path`. If path is empty,", + "`.` will be returned." + ], + "signature": "basename(path) -\u003e string", + "goFuncName": "fbasename", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [ + "Path", + "to", + "get", + "the", + "base", + "name", + "of." + ] + } + ], + "tags": { + "param": [ + { + "id": "path", + "fields": [ + "string", + "Path", + "to", + "get", + "the", + "base", + "name", + "of." + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 4 + } + ] + } + }, + { + "name": "cd", + "description": [ + "Changes Hilbish's directory to `dir`." + ], + "signature": "cd(dir)", + "goFuncName": "fcd", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "dir", + "Type": "string", + "Doc": [ + "Path", + "to", + "change", + "directory", + "to." + ] + } + ], + "tags": { + "param": [ + { + "id": "dir", + "fields": [ + "string", + "Path", + "to", + "change", + "directory", + "to." + ], + "StartIdx": 2 + } + ] + } + }, + { + "name": "dir", + "description": [ + "Returns the directory part of `path`. If a file path like", + "`~/Documents/doc.txt` then this function will return `~/Documents`." + ], + "signature": "dir(path) -\u003e string", + "goFuncName": "fdir", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [ + "Path", + "to", + "get", + "the", + "directory", + "for." + ] + } + ], + "tags": { + "param": [ + { + "id": "path", + "fields": [ + "string", + "Path", + "to", + "get", + "the", + "directory", + "for." + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 4 + } + ] + } + }, + { + "name": "glob", + "description": [ + "Match all files based on the provided `pattern`.", + "For the syntax' refer to Go's filepath.Match function: https://pkg.go.dev/path/filepath#Match", + "", + "" + ], + "signature": "glob(pattern) -\u003e matches (table)", + "goFuncName": "fglob", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "pattern", + "Type": "string", + "Doc": [ + "Pattern", + "to", + "compare", + "files", + "with." + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "--[[", + "\tWithin a folder that contains the following files:", + "\ta.txt", + "\tinit.lua", + "\tcode.lua", + "\tdoc.pdf", + "]]--", + "local matches = fs.glob './*.lua'", + "print(matches)", + "-- -\u003e {'init.lua', 'code.lua'}" + ], + "StartIdx": 6 + } + ], + "param": [ + { + "id": "pattern", + "fields": [ + "string", + "Pattern", + "to", + "compare", + "files", + "with." + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "table", + "fields": [ + "A", + "list", + "of", + "file", + "names/paths", + "that", + "match." + ], + "StartIdx": 4 + } + ] + } + }, + { + "name": "join", + "description": [ + "Takes any list of paths and joins them based on the operating system's path separator.", + "", + "" + ], + "signature": "join(...path) -\u003e string", + "goFuncName": "fjoin", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "...string", + "Doc": [ + "Paths", + "to", + "join", + "together" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- This prints the directory for Hilbish's config!", + "print(fs.join(hilbish.userDir.config, 'hilbish'))", + "-- -\u003e '/home/user/.config/hilbish' on Linux" + ], + "StartIdx": 5 + } + ], + "param": [ + { + "id": "path", + "fields": [ + "...string", + "Paths", + "to", + "join", + "together" + ], + "StartIdx": 2 + } + ], + "returns": [ + { + "id": "string", + "fields": [ + "The", + "joined", + "path." + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "mkdir", + "description": [ + "Creates a new directory with the provided `name`.", + "With `recursive`, mkdir will create parent directories.", + "", + "" + ], + "signature": "mkdir(name, recursive)", + "goFuncName": "fmkdir", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [ + "Name", + "of", + "the", + "directory" + ] + }, + { + "Name": "recursive", + "Type": "boolean", + "Doc": [ + "Whether", + "to", + "create", + "parent", + "directories", + "for", + "the", + "provided", + "name" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- This will create the directory foo, then create the directory bar in the", + "-- foo directory. If recursive is false in this case, it will fail.", + "fs.mkdir('./foo/bar', true)" + ], + "StartIdx": 6 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string", + "Name", + "of", + "the", + "directory" + ], + "StartIdx": 3 + }, + { + "id": "recursive", + "fields": [ + "boolean", + "Whether", + "to", + "create", + "parent", + "directories", + "for", + "the", + "provided", + "name" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "pipe", + "description": [ + "Returns a pair of connected files, also known as a pipe.", + "The type returned is a Lua file, same as returned from `io` functions." + ], + "signature": "fpipe() -\u003e File, File", + "goFuncName": "fpipe", + "isInterface": false, + "isMember": false, + "isType": false, + "tags": { + "returns": [ + { + "id": "File", + "fields": [], + "StartIdx": 3 + }, + { + "id": "File", + "fields": [], + "StartIdx": 0 + } + ] + } + }, + { + "name": "readdir", + "description": [ + "Returns a list of all files and directories in the provided path." + ], + "signature": "readdir(path) -\u003e table[string]", + "goFuncName": "freaddir", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "dir", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "dir", + "fields": [ + "string" + ], + "StartIdx": 2 + } + ], + "returns": [ + { + "id": "table", + "fields": [], + "StartIdx": 3 + } + ] + } + }, + { + "name": "stat", + "description": [ + "Returns the information about a given `path`.", + "The returned table contains the following values:", + "name (string) - Name of the path", + "size (number) - Size of the path in bytes", + "mode (string) - Unix permission mode in an octal format string (with leading 0)", + "isDir (boolean) - If the path is a directory", + "", + "" + ], + "signature": "stat(path) -\u003e {}", + "goFuncName": "fstat", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "local inspect = require 'inspect'", + "", + "local stat = fs.stat '~'", + "print(inspect(stat))", + "--[[", + "Would print the following:", + "{", + " isDir = true,", + " mode = \"0755\",", + " name = \"username\",", + " size = 12288", + "}", + "]]--" + ], + "StartIdx": 10 + } + ], + "param": [ + { + "id": "path", + "fields": [ + "string" + ], + "StartIdx": 7 + } + ], + "returns": [ + { + "id": "table", + "fields": [], + "StartIdx": 8 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/defs/hilbish.json b/defs/hilbish.json new file mode 100644 index 00000000..404f766e --- /dev/null +++ b/defs/hilbish.json @@ -0,0 +1,3267 @@ +{ + "name": "hilbish", + "shortDescription": "the core Hilbish API", + "description": "The Hilbish module includes the core API, containing\ninterfaces and functions which directly relate to shell functionality.", + "properties": [], + "fields": [ + { + "name": "ver", + "description": [ + "The", + "version", + "of", + "Hilbish" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "goVersion", + "description": [ + "The", + "version", + "of", + "Go", + "that", + "Hilbish", + "was", + "compiled", + "with" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "user", + "description": [ + "Username", + "of", + "the", + "user" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "host", + "description": [ + "Hostname", + "of", + "the", + "machine" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "dataDir", + "description": [ + "Directory", + "for", + "Hilbish", + "data", + "files,", + "including", + "the", + "docs", + "and", + "default", + "modules" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "interactive", + "description": [ + "Is", + "Hilbish", + "in", + "an", + "interactive", + "shell?" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "login", + "description": [ + "Is", + "Hilbish", + "the", + "login", + "shell?" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "vimMode", + "description": [ + "Current", + "Vim", + "input", + "mode", + "of", + "Hilbish", + "(will", + "be", + "nil", + "if", + "not", + "in", + "Vim", + "input", + "mode)" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "exitCode", + "description": [ + "Exit", + "code", + "of", + "the", + "last", + "executed", + "command" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "types": [ + { + "name": "Sink", + "description": [ + "A sink is a structure that has input and/or output to/from a desination." + ], + "parent": "hilbish", + "isInterface": false, + "isMember": false, + "isType": true, + "tags": { + "type": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + } + ], + "docs": [ + { + "name": "luaSinkAutoFlush", + "description": [ + "Sets/toggles the option of automatically flushing output.", + "A call with no argument will toggle the value." + ], + "signature": "autoFlush(auto)", + "goFuncName": "luasinkautoflush", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "luaSinkFlush", + "description": [ + "Flush writes all buffered input to the sink." + ], + "signature": "flush()", + "goFuncName": "luasinkflush", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "luaSinkRead", + "description": [ + "Reads a liine of input from the sink." + ], + "signature": "read() -\u003e string", + "goFuncName": "luasinkread", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "luaSinkReadAll", + "description": [ + "Reads all input from the sink." + ], + "signature": "readAll() -\u003e string", + "goFuncName": "luasinkreadall", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "luaSinkWrite", + "description": [ + "Writes data to a sink." + ], + "signature": "write(str)", + "goFuncName": "luasinkwrite", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "luaSinkWriteln", + "description": [ + "Writes data to a sink with a newline at the end." + ], + "signature": "writeln(str)", + "goFuncName": "luasinkwriteln", + "isInterface": false, + "isMember": true, + "isType": false, + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + }, + { + "name": "alias", + "description": [ + "Sets an alias, with a name of `cmd` to another command.", + "", + "" + ], + "signature": "alias(cmd, orig)", + "goFuncName": "hlalias", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cmd", + "Type": "string", + "Doc": [ + "Name", + "of", + "the", + "alias" + ] + }, + { + "Name": "orig", + "Type": "string", + "Doc": [ + "Command", + "that", + "will", + "be", + "aliased" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- With this, \"ga file\" will turn into \"git add file\"", + "hilbish.alias('ga', 'git add')", + "", + "-- Numbered substitutions are supported here!", + "hilbish.alias('dircount', 'ls %1 | wc -l')", + "-- \"dircount ~\" would count how many files are in ~ (home directory)." + ], + "StartIdx": 5 + } + ], + "param": [ + { + "id": "cmd", + "fields": [ + "string", + "Name", + "of", + "the", + "alias" + ], + "StartIdx": 2 + }, + { + "id": "orig", + "fields": [ + "string", + "Command", + "that", + "will", + "be", + "aliased" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "appendPath", + "description": [ + "Appends the provided dir to the command path (`$PATH`)", + "", + "" + ], + "signature": "appendPath(dir)", + "goFuncName": "hlappendpath", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "dir", + "Type": "string|table", + "Doc": [ + "Directory", + "(or", + "directories)", + "to", + "append", + "to", + "path" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "hilbish.appendPath '~/go/bin'", + "-- Will add ~/go/bin to the command path.", + "", + "-- Or do multiple:", + "hilbish.appendPath {", + "\t'~/go/bin',", + "\t'~/.local/bin'", + "}" + ], + "StartIdx": 4 + } + ], + "param": [ + { + "id": "dir", + "fields": [ + "string|table", + "Directory", + "(or", + "directories)", + "to", + "append", + "to", + "path" + ], + "StartIdx": 2 + } + ] + } + }, + { + "name": "complete", + "description": [ + "Registers a completion handler for the specified scope.", + "A `scope` is expected to be `command.\u003ccmd\u003e`,", + "replacing \u003ccmd\u003e with the name of the command (for example `command.git`).", + "The documentation for completions, under Features/Completions or `doc completions`", + "provides more details.", + "", + "" + ], + "signature": "complete(scope, cb)", + "goFuncName": "hlcomplete", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "scope", + "Type": "string", + "Doc": [] + }, + { + "Name": "cb", + "Type": "function", + "Doc": [] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- This is a very simple example. Read the full doc for completions for details.", + "hilbish.complete('command.sudo', function(query, ctx, fields)", + "\tif #fields == 0 then", + "\t\t-- complete for commands", + "\t\tlocal comps, pfx = hilbish.completion.bins(query, ctx, fields)", + "\t\tlocal compGroup = {", + "\t\t\titems = comps, -- our list of items to complete", + "\t\t\ttype = 'grid' -- what our completions will look like.", + "\t\t}", + "", + "\t\treturn {compGroup}, pfx", + "\tend", + "", + "\t-- otherwise just be boring and return files", + "", + "\tlocal comps, pfx = hilbish.completion.files(query, ctx, fields)", + "\tlocal compGroup = {", + "\t\titems = comps,", + "\t\ttype = 'grid'", + "\t}", + "", + "\treturn {compGroup}, pfx", + "end)" + ], + "StartIdx": 9 + } + ], + "param": [ + { + "id": "scope", + "fields": [ + "string" + ], + "StartIdx": 6 + }, + { + "id": "cb", + "fields": [ + "function" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "cwd", + "description": [ + "Returns the current directory of the shell." + ], + "signature": "cwd() -\u003e string", + "goFuncName": "hlcwd", + "isInterface": false, + "isMember": false, + "isType": false, + "tags": { + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 2 + } + ] + } + }, + { + "name": "exec", + "description": [ + "Replaces the currently running Hilbish instance with the supplied command.", + "This can be used to do an in-place restart." + ], + "signature": "exec(cmd)", + "goFuncName": "hlexec", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cmd", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "cmd", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "goro", + "description": [ + "Puts `fn` in a Goroutine.", + "This can be used to run any function in another thread at the same time as other Lua code.", + "**NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.**", + "**This is a limitation of the Lua runtime.**" + ], + "signature": "goro(fn)", + "goFuncName": "hlgoro", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "fn", + "Type": "function", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "fn", + "fields": [ + "function" + ], + "StartIdx": 5 + } + ] + } + }, + { + "name": "highlighter", + "description": [ + "Line highlighter handler.", + "This is mainly for syntax highlighting, but in reality could set the input", + "of the prompt to *display* anything. The callback is passed the current line", + "and is expected to return a line that will be used as the input display.", + "Note that to set a highlighter, one has to override this function.", + "" + ], + "signature": "highlighter(line)", + "goFuncName": "hlhighlighter", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "line", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "--This code will highlight all double quoted strings in green.", + "function hilbish.highlighter(line)", + " return line:gsub('\"%w+\"', function(c) return lunacolors.green(c) end)", + "end" + ], + "StartIdx": 6 + } + ], + "param": [ + { + "id": "line", + "fields": [ + "string" + ], + "StartIdx": 12 + } + ] + } + }, + { + "name": "hinter", + "description": [ + "The command line hint handler. It gets called on every key insert to", + "determine what text to use as an inline hint. It is passed the current", + "line and cursor position. It is expected to return a string which is used", + "as the text for the hint. This is by default a shim. To set hints,", + "override this function with your custom handler.", + "", + "" + ], + "signature": "hinter(line, pos)", + "goFuncName": "hlhinter", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "line", + "Type": "string", + "Doc": [] + }, + { + "Name": "pos", + "Type": "number", + "Doc": [ + "Position", + "of", + "cursor", + "in", + "line.", + "Usually", + "equals", + "string.len(line)" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- this will display \"hi\" after the cursor in a dimmed color.", + "function hilbish.hinter(line, pos)", + "\treturn 'hi'", + "end" + ], + "StartIdx": 9 + } + ], + "param": [ + { + "id": "line", + "fields": [ + "string" + ], + "StartIdx": 6 + }, + { + "id": "pos", + "fields": [ + "number", + "Position", + "of", + "cursor", + "in", + "line.", + "Usually", + "equals", + "string.len(line)" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "inputMode", + "description": [ + "Sets the input mode for Hilbish's line reader.", + "`emacs` is the default. Setting it to `vim` changes behavior of input to be", + "Vim-like with modes and Vim keybinds." + ], + "signature": "inputMode(mode)", + "goFuncName": "hlinputmode", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "mode", + "Type": "string", + "Doc": [ + "Can", + "be", + "set", + "to", + "either", + "`emacs`", + "or", + "`vim`" + ] + } + ], + "tags": { + "param": [ + { + "id": "mode", + "fields": [ + "string", + "Can", + "be", + "set", + "to", + "either", + "`emacs`", + "or", + "`vim`" + ], + "StartIdx": 4 + } + ] + } + }, + { + "name": "interval", + "description": [ + "Runs the `cb` function every specified amount of `time`.", + "This creates a timer that ticking immediately." + ], + "signature": "interval(cb, time) -\u003e @Timer", + "goFuncName": "hlinterval", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cb", + "Type": "function", + "Doc": [] + }, + { + "Name": "time", + "Type": "number", + "Doc": [ + "Time", + "in", + "milliseconds." + ] + } + ], + "tags": { + "param": [ + { + "id": "cb", + "fields": [ + "function" + ], + "StartIdx": 3 + }, + { + "id": "time", + "fields": [ + "number", + "Time", + "in", + "milliseconds." + ], + "StartIdx": 0 + } + ], + "return": [ + { + "id": "Timer", + "fields": [], + "StartIdx": 5 + } + ] + } + }, + { + "name": "multiprompt", + "description": [ + "Changes the text prompt when Hilbish asks for more input.", + "This will show up when text is incomplete, like a missing quote", + "", + "" + ], + "signature": "multiprompt(str)", + "goFuncName": "hlmultiprompt", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "str", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "--[[", + "imagine this is your text input:", + "user ~ ∆ echo \"hey", + "", + "but there's a missing quote! hilbish will now prompt you so the terminal", + "will look like:", + "user ~ ∆ echo \"hey", + "--\u003e ...!\"", + "", + "so then you get", + "user ~ ∆ echo \"hey", + "--\u003e ...!\"", + "hey ...!", + "]]--", + "hilbish.multiprompt '--\u003e'" + ], + "StartIdx": 5 + } + ], + "param": [ + { + "id": "str", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "prependPath", + "description": [ + "Prepends `dir` to $PATH." + ], + "signature": "prependPath(dir)", + "goFuncName": "hlprependpath", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "dir", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "dir", + "fields": [ + "string" + ], + "StartIdx": 2 + } + ] + } + }, + { + "name": "prompt", + "description": [ + "Changes the shell prompt to the provided string.", + "There are a few verbs that can be used in the prompt text.", + "These will be formatted and replaced with the appropriate values.", + "`%d` - Current working directory", + "`%u` - Name of current user", + "`%h` - Hostname of device", + "" + ], + "signature": "prompt(str, typ)", + "goFuncName": "hlprompt", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "str", + "Type": "string", + "Doc": [] + }, + { + "Name": "typ?", + "Type": "string", + "Doc": [ + "Type", + "of", + "prompt,", + "being", + "left", + "or", + "right.", + "Left", + "by", + "default." + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- the default hilbish prompt without color", + "hilbish.prompt '%u %d ∆'", + "-- or something of old:", + "hilbish.prompt '%u@%h :%d $'", + "-- prompt: user@hostname: ~/directory $" + ], + "StartIdx": 9 + } + ], + "param": [ + { + "id": "str", + "fields": [ + "string" + ], + "StartIdx": 7 + }, + { + "id": "typ?", + "fields": [ + "string", + "Type", + "of", + "prompt,", + "being", + "left", + "or", + "right.", + "Left", + "by", + "default." + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "read", + "description": [ + "Read input from the user, using Hilbish's line editor/input reader.", + "This is a separate instance from the one Hilbish actually uses.", + "Returns `input`, will be nil if Ctrl-D is pressed, or an error occurs." + ], + "signature": "read(prompt) -\u003e input (string)", + "goFuncName": "hlread", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "prompt?", + "Type": "string", + "Doc": [ + "Text", + "to", + "print", + "before", + "input,", + "can", + "be", + "empty." + ] + } + ], + "tags": { + "param": [ + { + "id": "prompt?", + "fields": [ + "string", + "Text", + "to", + "print", + "before", + "input,", + "can", + "be", + "empty." + ], + "StartIdx": 4 + } + ], + "returns": [ + { + "id": "string|nil", + "fields": [], + "StartIdx": 5 + } + ] + } + }, + { + "name": "timeout", + "description": [ + "Executed the `cb` function after a period of `time`.", + "This creates a Timer that starts ticking immediately." + ], + "signature": "timeout(cb, time) -\u003e @Timer", + "goFuncName": "hltimeout", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cb", + "Type": "function", + "Doc": [] + }, + { + "Name": "time", + "Type": "number", + "Doc": [ + "Time", + "to", + "run", + "in", + "milliseconds." + ] + } + ], + "tags": { + "param": [ + { + "id": "cb", + "fields": [ + "function" + ], + "StartIdx": 3 + }, + { + "id": "time", + "fields": [ + "number", + "Time", + "to", + "run", + "in", + "milliseconds." + ], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "Timer", + "fields": [], + "StartIdx": 5 + } + ] + } + }, + { + "name": "which", + "description": [ + "Checks if `name` is a valid command.", + "Will return the path of the binary, or a basename if it's a commander." + ], + "signature": "which(name) -\u003e string", + "goFuncName": "hlwhich", + "isInterface": false, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "param": [ + { + "id": "name", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 4 + } + ] + } + } + ], + "interfaces": { + "hilbish.aliases": { + "name": "hilbish.aliases", + "shortDescription": "command aliasing", + "description": "The alias interface deals with all command aliases in Hilbish.", + "parent": "hilbish", + "properties": [], + "fields": [], + "docs": [ + { + "name": "aliases.add", + "description": [ + "This is an alias (ha) for the [hilbish.alias](../#alias) function." + ], + "parent": "hilbish", + "interfaces": "aliases", + "signature": "add(alias, cmd)", + "goFuncName": "_hlalias", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "aliases", + "fields": [], + "StartIdx": 0 + } + ] + } + }, + { + "name": "aliases.delete", + "description": [ + "Removes an alias." + ], + "parent": "hilbish", + "interfaces": "aliases", + "signature": "delete(name)", + "goFuncName": "luadelete", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "aliases", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "aliases.list", + "description": [ + "Get a table of all aliases, with string keys as the alias and the value as the command.", + "", + "" + ], + "parent": "hilbish", + "interfaces": "aliases", + "signature": "list() -\u003e table[string, string]", + "goFuncName": "lualist", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "example": [ + { + "id": "", + "fields": [ + "hilbish.aliases.add('hi', 'echo hi')", + "", + "local aliases = hilbish.aliases.list()", + "-- -\u003e {hi = 'echo hi'}" + ], + "StartIdx": 5 + } + ], + "interface": [ + { + "id": "aliases", + "fields": [], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "table[string,", + "fields": [ + "string]" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "aliases.resolve", + "description": [ + "Resolves an alias to its original command. Will thrown an error if the alias doesn't exist." + ], + "parent": "hilbish", + "interfaces": "aliases", + "signature": "resolve(alias) -\u003e string?", + "goFuncName": "luaresolve", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "alias", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "aliases", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "alias", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 4 + } + ] + } + } + ] + }, + "hilbish.completion": { + "name": "hilbish.completion", + "shortDescription": "tab completions", + "description": "The completions interface deals with tab completions.", + "parent": "hilbish", + "properties": [], + "fields": [], + "docs": [ + { + "name": "completion.bins", + "description": [ + "Return binaries/executables based on the provided parameters.", + "This function is meant to be used as a helper in a command completion handler.", + "", + "" + ], + "parent": "hilbish", + "interfaces": "completion", + "signature": "bins(query, ctx, fields) -\u003e entries (table), prefix (string)", + "goFuncName": "hcmpbins", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "query", + "Type": "string", + "Doc": [] + }, + { + "Name": "ctx", + "Type": "string", + "Doc": [] + }, + { + "Name": "fields", + "Type": "table", + "Doc": [] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- an extremely simple completer for sudo.", + "hilbish.complete('command.sudo', function(query, ctx, fields)", + "\ttable.remove(fields, 1)", + "\tif #fields[1] then", + "\t\t-- return commands because sudo runs a command as root..!", + "", + "\t\tlocal entries, pfx = hilbish.completion.bins(query, ctx, fields)", + "\t\treturn {", + "\t\t\ttype = 'grid',", + "\t\t\titems = entries", + "\t\t}, pfx", + "\tend", + "", + "\t-- ... else suggest files or anything else ..", + "end)" + ], + "StartIdx": 8 + } + ], + "interface": [ + { + "id": "completion", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "query", + "fields": [ + "string" + ], + "StartIdx": 4 + }, + { + "id": "ctx", + "fields": [ + "string" + ], + "StartIdx": 0 + }, + { + "id": "fields", + "fields": [ + "table" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "completion.call", + "description": [ + "Calls a completer function. This is mainly used to call a command completer, which will have a `name`", + "in the form of `command.name`, example: `command.git`.", + "You can check the Completions doc or `doc completions` for info on the `completionGroups` return value." + ], + "parent": "hilbish", + "interfaces": "completion", + "signature": "call(name, query, ctx, fields) -\u003e completionGroups (table), prefix (string)", + "goFuncName": "hcmpcall", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "name", + "Type": "string", + "Doc": [] + }, + { + "Name": "query", + "Type": "string", + "Doc": [] + }, + { + "Name": "ctx", + "Type": "string", + "Doc": [] + }, + { + "Name": "fields", + "Type": "table", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "completion", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "name", + "fields": [ + "string" + ], + "StartIdx": 5 + }, + { + "id": "query", + "fields": [ + "string" + ], + "StartIdx": 0 + }, + { + "id": "ctx", + "fields": [ + "string" + ], + "StartIdx": 0 + }, + { + "id": "fields", + "fields": [ + "table" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "completion.files", + "description": [ + "Returns file matches based on the provided parameters.", + "This function is meant to be used as a helper in a command completion handler." + ], + "parent": "hilbish", + "interfaces": "completion", + "signature": "files(query, ctx, fields) -\u003e entries (table), prefix (string)", + "goFuncName": "hcmpfiles", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "query", + "Type": "string", + "Doc": [] + }, + { + "Name": "ctx", + "Type": "string", + "Doc": [] + }, + { + "Name": "fields", + "Type": "table", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "completion", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "query", + "fields": [ + "string" + ], + "StartIdx": 4 + }, + { + "id": "ctx", + "fields": [ + "string" + ], + "StartIdx": 0 + }, + { + "id": "fields", + "fields": [ + "table" + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "completion.handler", + "description": [ + "This function contains the general completion handler for Hilbish. This function handles", + "completion of everything, which includes calling other command handlers, binaries, and files.", + "This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function.", + "", + "" + ], + "parent": "hilbish", + "interfaces": "completion", + "signature": "handler(line, pos)", + "goFuncName": "hcmphandler", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "line", + "Type": "string", + "Doc": [ + "The", + "current", + "Hilbish", + "command", + "line" + ] + }, + { + "Name": "pos", + "Type": "number", + "Doc": [ + "Numerical", + "position", + "of", + "the", + "cursor" + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "-- stripped down version of the default implementation", + "function hilbish.completion.handler(line, pos)", + "\tlocal query = fields[#fields]", + "", + "\tif #fields == 1 then", + "\t\t-- call bins handler here", + "\telse", + "\t\t-- call command completer or files completer here", + "\tend", + "end" + ], + "StartIdx": 8 + } + ], + "interface": [ + { + "id": "completion", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "line", + "fields": [ + "string", + "The", + "current", + "Hilbish", + "command", + "line" + ], + "StartIdx": 5 + }, + { + "id": "pos", + "fields": [ + "number", + "Numerical", + "position", + "of", + "the", + "cursor" + ], + "StartIdx": 0 + } + ] + } + } + ] + }, + "hilbish.editor": { + "name": "hilbish.editor", + "shortDescription": "interactions for Hilbish's line reader", + "description": "The hilbish.editor interface provides functions to\ndirectly interact with the line editor in use.", + "parent": "hilbish", + "properties": [], + "fields": [], + "docs": [ + { + "name": "editor.deleteByAmount", + "description": [ + "Deletes characters in the line by the given amount." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "deleteByAmount(amount)", + "goFuncName": "editordeletebyamount", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "amount", + "Type": "number", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "amount", + "fields": [ + "number" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "editor.getLine", + "description": [ + "Returns the current input line." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "getLine() -\u003e string", + "goFuncName": "editorgetline", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "string", + "fields": [], + "StartIdx": 3 + } + ] + } + }, + { + "name": "editor.getVimRegister", + "description": [ + "Returns the text that is at the register." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "getVimRegister(register) -\u003e string", + "goFuncName": "editorgetregister", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "register", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "register", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "editor.insert", + "description": [ + "Inserts text into the Hilbish command line." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "insert(text)", + "goFuncName": "editorinsert", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "text", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "text", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "editor.getChar", + "description": [ + "Reads a keystroke from the user. This is in a format of something like Ctrl-L." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "getChar() -\u003e string", + "goFuncName": "editorreadchar", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ] + } + }, + { + "name": "editor.setVimRegister", + "description": [ + "Sets the vim register at `register` to hold the passed text." + ], + "parent": "hilbish", + "interfaces": "editor", + "signature": "setVimRegister(register, text)", + "goFuncName": "editorsetregister", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "register", + "Type": "string", + "Doc": [] + }, + { + "Name": "text", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "editor", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "register", + "fields": [ + "string" + ], + "StartIdx": 3 + }, + { + "id": "text", + "fields": [ + "string" + ], + "StartIdx": 0 + } + ] + } + } + ] + }, + "hilbish.history": { + "name": "hilbish.history", + "shortDescription": "command history", + "description": "The history interface deals with command history.\nThis includes the ability to override functions to change the main\nmethod of saving history.", + "parent": "hilbish", + "properties": [], + "fields": [], + "docs": [ + { + "name": "history.add", + "description": [ + "Adds a command to the history." + ], + "parent": "hilbish", + "interfaces": "history", + "signature": "add(cmd)", + "goFuncName": "luaaddhistory", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cmd", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "history", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "cmd", + "fields": [ + "string" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "history.all", + "description": [ + "Retrieves all history as a table." + ], + "parent": "hilbish", + "interfaces": "history", + "signature": "all() -\u003e table", + "goFuncName": "luaallhistory", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "history", + "fields": [], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "table", + "fields": [], + "StartIdx": 3 + } + ] + } + }, + { + "name": "history.clear", + "description": [ + "Deletes all commands from the history." + ], + "parent": "hilbish", + "interfaces": "history", + "signature": "clear()", + "goFuncName": "luaclearhistory", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "history", + "fields": [], + "StartIdx": 0 + } + ] + } + }, + { + "name": "history.get", + "description": [ + "Retrieves a command from the history based on the `index`." + ], + "parent": "hilbish", + "interfaces": "history", + "signature": "get(index)", + "goFuncName": "luagethistory", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "index", + "Type": "number", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "history", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "index", + "fields": [ + "number" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "history.size", + "description": [ + "Returns the amount of commands in the history." + ], + "parent": "hilbish", + "interfaces": "history", + "signature": "size() -\u003e number", + "goFuncName": "luasize", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "eturns": [ + { + "id": "number", + "fields": [], + "StartIdx": 3 + } + ], + "interface": [ + { + "id": "history", + "fields": [], + "StartIdx": 0 + } + ] + } + } + ] + }, + "hilbish.jobs": { + "name": "hilbish.jobs", + "shortDescription": "background job management", + "description": "\nManage interactive jobs in Hilbish via Lua.\n\nJobs are the name of background tasks/commands. A job can be started via\ninteractive usage or with the functions defined below for use in external runners.", + "parent": "hilbish", + "properties": [], + "fields": [], + "types": [ + { + "name": "Job", + "description": [ + "The Job type describes a Hilbish job." + ], + "parent": "hilbish", + "interfaces": "jobs", + "isInterface": true, + "isMember": false, + "isType": true, + "properties": [ + { + "name": "cmd", + "description": [ + "The", + "user", + "entered", + "command", + "string", + "for", + "the", + "job." + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "running", + "description": [ + "Whether", + "the", + "job", + "is", + "running", + "or", + "not." + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "id", + "description": [ + "The", + "ID", + "of", + "the", + "job", + "in", + "the", + "job", + "table" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "pid", + "description": [ + "The", + "Process", + "ID" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "exitCode", + "description": [ + "The", + "last", + "exit", + "code", + "of", + "the", + "job." + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "stdout", + "description": [ + "The", + "standard", + "output", + "of", + "the", + "job.", + "This", + "just", + "means", + "the", + "normal", + "logs", + "of", + "the", + "process." + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "stderr", + "description": [ + "The", + "standard", + "error", + "stream", + "of", + "the", + "process.", + "This", + "(usually)", + "includes", + "error", + "messages", + "of", + "the", + "job." + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 1 + } + ], + "property": [ + { + "id": "cmd", + "fields": [ + "The", + "user", + "entered", + "command", + "string", + "for", + "the", + "job." + ], + "StartIdx": 2 + }, + { + "id": "running", + "fields": [ + "Whether", + "the", + "job", + "is", + "running", + "or", + "not." + ], + "StartIdx": 0 + }, + { + "id": "id", + "fields": [ + "The", + "ID", + "of", + "the", + "job", + "in", + "the", + "job", + "table" + ], + "StartIdx": 0 + }, + { + "id": "pid", + "fields": [ + "The", + "Process", + "ID" + ], + "StartIdx": 0 + }, + { + "id": "exitCode", + "fields": [ + "The", + "last", + "exit", + "code", + "of", + "the", + "job." + ], + "StartIdx": 0 + }, + { + "id": "stdout", + "fields": [ + "The", + "standard", + "output", + "of", + "the", + "job.", + "This", + "just", + "means", + "the", + "normal", + "logs", + "of", + "the", + "process." + ], + "StartIdx": 0 + }, + { + "id": "stderr", + "fields": [ + "The", + "standard", + "error", + "stream", + "of", + "the", + "process.", + "This", + "(usually)", + "includes", + "error", + "messages", + "of", + "the", + "job." + ], + "StartIdx": 0 + } + ], + "type": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + } + ], + "docs": [ + { + "name": "jobs.background", + "description": [ + "Puts a job in the background. This acts the same as initially running a job." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "background()", + "goFuncName": "luabackgroundjob", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "jobs.foreground", + "description": [ + "Puts a job in the foreground. This will cause it to run like it was", + "executed normally and wait for it to complete." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "foreground()", + "goFuncName": "luaforegroundjob", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "jobs.start", + "description": [ + "Starts running the job." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "start()", + "goFuncName": "luastartjob", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "jobs.stop", + "description": [ + "Stops the job from running." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "stop()", + "goFuncName": "luastopjob", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "jobs.add", + "description": [ + "Creates a new job. This function does not run the job. This function is intended to be", + "used by runners, but can also be used to create jobs via Lua. Commanders cannot be ran as jobs.", + "", + "" + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "add(cmdstr, args, execPath)", + "goFuncName": "luaaddjob", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cmdstr", + "Type": "string", + "Doc": [ + "String", + "that", + "a", + "user", + "would", + "write", + "for", + "the", + "job" + ] + }, + { + "Name": "args", + "Type": "table", + "Doc": [ + "Arguments", + "for", + "the", + "commands.", + "Has", + "to", + "include", + "the", + "name", + "of", + "the", + "command." + ] + }, + { + "Name": "execPath", + "Type": "string", + "Doc": [ + "Binary", + "to", + "use", + "to", + "run", + "the", + "command.", + "Needs", + "to", + "be", + "an", + "absolute", + "path." + ] + } + ], + "tags": { + "example": [ + { + "id": "", + "fields": [ + "hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go')" + ], + "StartIdx": 8 + } + ], + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "cmdstr", + "fields": [ + "string", + "String", + "that", + "a", + "user", + "would", + "write", + "for", + "the", + "job" + ], + "StartIdx": 4 + }, + { + "id": "args", + "fields": [ + "table", + "Arguments", + "for", + "the", + "commands.", + "Has", + "to", + "include", + "the", + "name", + "of", + "the", + "command." + ], + "StartIdx": 0 + }, + { + "id": "execPath", + "fields": [ + "string", + "Binary", + "to", + "use", + "to", + "run", + "the", + "command.", + "Needs", + "to", + "be", + "an", + "absolute", + "path." + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "jobs.all", + "description": [ + "Returns a table of all job objects." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "all() -\u003e table[@Job]", + "goFuncName": "luaalljobs", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "table[Job]", + "fields": [], + "StartIdx": 3 + } + ] + } + }, + { + "name": "jobs.disown", + "description": [ + "Disowns a job. This simply deletes it from the list of jobs without stopping it." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "disown(id)", + "goFuncName": "luadisownjob", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "id", + "Type": "number", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "id", + "fields": [ + "number" + ], + "StartIdx": 3 + } + ] + } + }, + { + "name": "jobs.get", + "description": [ + "Get a job object via its ID." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "get(id) -\u003e @Job", + "goFuncName": "luagetjob", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ] + } + }, + { + "name": "jobs.last", + "description": [ + "Returns the last added job to the table." + ], + "parent": "hilbish", + "interfaces": "jobs", + "signature": "last() -\u003e @Job", + "goFuncName": "lualastjob", + "isInterface": true, + "isMember": false, + "isType": false, + "tags": { + "interface": [ + { + "id": "jobs", + "fields": [], + "StartIdx": 0 + } + ], + "returns": [ + { + "id": "Job", + "fields": [], + "StartIdx": 3 + } + ] + } + } + ] + }, + "hilbish.module": { + "name": "hilbish.module", + "shortDescription": "native module loading", + "description": "\nThe hilbish.module interface provides a function to load\nHilbish plugins/modules. Hilbish modules are Go-written\nplugins (see https://pkg.go.dev/plugin) that are used to add functionality\nto Hilbish that cannot be written in Lua for any reason.\n\nNote that you don't ever need to use the load function that is here as\nmodules can be loaded with a `require` call like Lua C modules, and the\nsearch paths can be changed with the `paths` property here.\n\nTo make a valid native module, the Go plugin has to export a Loader function\nwith a signature like so: `func(*rt.Runtime) rt.Value`.\n\n`rt` in this case refers to the Runtime type at\nhttps://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime\n\nHilbish uses this package as its Lua runtime. You will need to read\nit to use it for a native plugin.\n\nHere is some code for an example plugin:\n```go\npackage main\n\nimport (\n\trt \"github.com/arnodel/golua/runtime\"\n)\n\nfunc Loader(rtm *rt.Runtime) rt.Value {\n\treturn rt.StringValue(\"hello world!\")\n}\n```\n\nThis can be compiled with `go build -buildmode=plugin plugin.go`.\nIf you attempt to require and print the result (`print(require 'plugin')`), it will show \"hello world!\"", + "parent": "hilbish", + "properties": [], + "fields": [ + { + "name": "paths", + "description": [ + "A", + "list", + "of", + "paths", + "to", + "search", + "when", + "loading", + "native", + "modules.", + "This", + "is", + "in", + "the", + "style", + "of", + "Lua", + "search", + "paths", + "and", + "will", + "be", + "used", + "when", + "requiring", + "native", + "modules.", + "Example:", + "`?.so;?/?.so`" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "docs": [ + { + "name": "module.load", + "description": [ + "Loads a module at the designated `path`.", + "It will throw if any error occurs." + ], + "parent": "hilbish", + "interfaces": "module", + "signature": "load(path)", + "goFuncName": "moduleload", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "module", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "path", + "fields": [ + "string" + ], + "StartIdx": 4 + } + ] + } + } + ] + }, + "hilbish.os": { + "name": "hilbish.os", + "shortDescription": "operating system info", + "description": "Provides simple text information properties about the current operating system.\nThis mainly includes the name and version.", + "parent": "hilbish", + "properties": [], + "fields": [ + { + "name": "family", + "description": [ + "Family", + "name", + "of", + "the", + "current", + "OS" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "name", + "description": [ + "Pretty", + "name", + "of", + "the", + "current", + "OS" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "version", + "description": [ + "Version", + "of", + "the", + "current", + "OS" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "docs": null + }, + "hilbish.runner": { + "name": "hilbish.runner", + "shortDescription": "interactive command runner customization", + "description": " The runner interface contains functions that allow the user to change\nhow Hilbish interprets interactive input.\nUsers can add and change the default runner for interactive input to any\nlanguage or script of their choosing. A good example is using it to\nwrite command in Fennel.\n\nRunners are functions that evaluate user input. The default runners in\nHilbish can run shell script and Lua code.\n\nA runner is passed the input and has to return a table with these values.\nAll are not required, only the useful ones the runner needs to return.\n(So if there isn't an error, just omit `err`.)\n\n- `exitCode` (number): Exit code of the command\n- `input` (string): The text input of the user. This is used by Hilbish to append extra input, in case\nmore is requested.\n- `err` (string): A string that represents an error from the runner.\nThis should only be set when, for example, there is a syntax error.\nIt can be set to a few special values for Hilbish to throw the right\nhooks and have a better looking message.\n\t- `\u003ccommand\u003e: not-found` will throw a `command.not-found` hook\n\tbased on what `\u003ccommand\u003e` is.\n\t- `\u003ccommand\u003e: not-executable` will throw a `command.not-executable` hook.\n- `continue` (boolean): Whether Hilbish should prompt the user for no input\n- `newline` (boolean): Whether a newline should be added at the end of `input`.\n\nHere is a simple example of a fennel runner. It falls back to\nshell script if fennel eval has an error.\n```lua\nlocal fennel = require 'fennel'\n\nhilbish.runnerMode(function(input)\n\tlocal ok = pcall(fennel.eval, input)\n\tif ok then\n\t\treturn {\n\t\t\tinput = input\n\t\t}\n\tend\n\n\treturn hilbish.runner.sh(input)\nend)\n```", + "parent": "hilbish", + "properties": [], + "fields": [], + "docs": [ + { + "name": "runner.lua", + "description": [ + "Evaluates `cmd` as Lua input. This is the same as using `dofile`", + "or `load`, but is appropriated for the runner interface." + ], + "parent": "hilbish", + "interfaces": "runner", + "signature": "lua(cmd)", + "goFuncName": "luarunner", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "cmd", + "Type": "string", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "runner", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "cmd", + "fields": [ + "string" + ], + "StartIdx": 4 + } + ] + } + } + ] + }, + "hilbish.timers": { + "name": "hilbish.timers", + "shortDescription": "timeout and interval API", + "description": "\nIf you ever want to run a piece of code on a timed interval, or want to wait\na few seconds, you don't have to rely on timing tricks, as Hilbish has a\ntimer API to set intervals and timeouts.\n\nThese are the simple functions `hilbish.interval` and `hilbish.timeout` (doc\naccessible with `doc hilbish`, or `Module hilbish` on the Website).\n\nAn example of usage:\n```lua\nlocal t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function()\n\tprint 'hello!'\nend)\n\nt:start()\nprint(t.running) // true\n```", + "parent": "hilbish", + "properties": [], + "fields": [ + { + "name": "INTERVAL", + "description": [ + "Constant", + "for", + "an", + "interval", + "timer", + "type" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "TIMEOUT", + "description": [ + "Constant", + "for", + "a", + "timeout", + "timer", + "type" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "types": [ + { + "name": "Timer", + "description": [ + "The Job type describes a Hilbish timer." + ], + "parent": "hilbish", + "interfaces": "timers", + "isInterface": true, + "isMember": false, + "isType": true, + "properties": [ + { + "name": "type", + "description": [ + "What", + "type", + "of", + "timer", + "it", + "is" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "running", + "description": [ + "If", + "the", + "timer", + "is", + "running" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "duration", + "description": [ + "The", + "duration", + "in", + "milliseconds", + "that", + "the", + "timer", + "will", + "run" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "tags": { + "interface": [ + { + "id": "timers", + "fields": [], + "StartIdx": 1 + } + ], + "property": [ + { + "id": "type", + "fields": [ + "What", + "type", + "of", + "timer", + "it", + "is" + ], + "StartIdx": 2 + }, + { + "id": "running", + "fields": [ + "If", + "the", + "timer", + "is", + "running" + ], + "StartIdx": 0 + }, + { + "id": "duration", + "fields": [ + "The", + "duration", + "in", + "milliseconds", + "that", + "the", + "timer", + "will", + "run" + ], + "StartIdx": 0 + } + ], + "type": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + } + ], + "docs": [ + { + "name": "timers.start", + "description": [ + "Starts a timer." + ], + "parent": "hilbish", + "interfaces": "timers", + "signature": "start()", + "goFuncName": "timerstart", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "timers", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "timers.stop", + "description": [ + "Stops a timer." + ], + "parent": "hilbish", + "interfaces": "timers", + "signature": "stop()", + "goFuncName": "timerstop", + "isInterface": true, + "isMember": true, + "isType": false, + "tags": { + "interface": [ + { + "id": "timers", + "fields": [], + "StartIdx": 0 + } + ], + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 1 + } + ] + } + }, + { + "name": "timers.create", + "description": [ + "Creates a timer that runs based on the specified `time`." + ], + "parent": "hilbish", + "interfaces": "timers", + "signature": "create(type, time, callback) -\u003e @Timer", + "goFuncName": "luacreate", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "type", + "Type": "number", + "Doc": [ + "What", + "kind", + "of", + "timer", + "to", + "create,", + "can", + "either", + "be", + "`hilbish.timers.INTERVAL`", + "or", + "`hilbish.timers.TIMEOUT`" + ] + }, + { + "Name": "time", + "Type": "number", + "Doc": [ + "The", + "amount", + "of", + "time", + "the", + "function", + "should", + "run", + "in", + "milliseconds." + ] + }, + { + "Name": "callback", + "Type": "function", + "Doc": [ + "The", + "function", + "to", + "run", + "for", + "the", + "timer." + ] + } + ], + "tags": { + "interface": [ + { + "id": "timers", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "type", + "fields": [ + "number", + "What", + "kind", + "of", + "timer", + "to", + "create,", + "can", + "either", + "be", + "`hilbish.timers.INTERVAL`", + "or", + "`hilbish.timers.TIMEOUT`" + ], + "StartIdx": 3 + }, + { + "id": "time", + "fields": [ + "number", + "The", + "amount", + "of", + "time", + "the", + "function", + "should", + "run", + "in", + "milliseconds." + ], + "StartIdx": 0 + }, + { + "id": "callback", + "fields": [ + "function", + "The", + "function", + "to", + "run", + "for", + "the", + "timer." + ], + "StartIdx": 0 + } + ] + } + }, + { + "name": "timers.get", + "description": [ + "Retrieves a timer via its ID." + ], + "parent": "hilbish", + "interfaces": "timers", + "signature": "get(id) -\u003e @Timer", + "goFuncName": "luaget", + "isInterface": true, + "isMember": false, + "isType": false, + "params": [ + { + "Name": "id", + "Type": "number", + "Doc": [] + } + ], + "tags": { + "interface": [ + { + "id": "timers", + "fields": [], + "StartIdx": 0 + } + ], + "param": [ + { + "id": "id", + "fields": [ + "number" + ], + "StartIdx": 3 + } + ], + "returns": [ + { + "id": "Timer", + "fields": [], + "StartIdx": 4 + } + ] + } + } + ] + }, + "hilbish.userDir": { + "name": "hilbish.userDir", + "shortDescription": "user-related directories", + "description": "This interface just contains properties to know about certain user directories.\nIt is equivalent to XDG on Linux and gets the user's preferred directories\nfor configs and data.", + "parent": "hilbish", + "properties": [], + "fields": [ + { + "name": "config", + "description": [ + "The", + "user's", + "config", + "directory" + ], + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "data", + "description": [ + "The", + "user's", + "directory", + "for", + "program", + "data" + ], + "isInterface": false, + "isMember": false, + "isType": false + } + ], + "docs": null + } + } +} \ No newline at end of file diff --git a/defs/snail.json b/defs/snail.json new file mode 100644 index 00000000..2be59369 --- /dev/null +++ b/defs/snail.json @@ -0,0 +1,140 @@ +{ + "name": "snail", + "shortDescription": "shell script interpreter library", + "description": "\nThe snail library houses Hilbish's Lua wrapper of its shell script interpreter.\nIt's not very useful other than running shell scripts, which can be done with other\nHilbish functions.", + "properties": [], + "fields": [], + "types": [ + { + "name": "Snail", + "description": [ + "A Snail is a shell script interpreter instance." + ], + "parent": "snail", + "isInterface": false, + "isMember": false, + "isType": true, + "tags": { + "type": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ] + } + } + ], + "docs": [ + { + "name": "dir", + "description": [ + "Changes the directory of the snail instance.", + "The interpreter keeps its set directory even when the Hilbish process changes", + "directory, so this should be called on the `hilbish.cd` hook." + ], + "signature": "dir(path)", + "goFuncName": "snaildir", + "isInterface": false, + "isMember": true, + "isType": false, + "params": [ + { + "Name": "path", + "Type": "string", + "Doc": [ + "Has", + "to", + "be", + "an", + "absolute", + "path." + ] + } + ], + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ], + "param": [ + { + "id": "path", + "fields": [ + "string", + "Has", + "to", + "be", + "an", + "absolute", + "path." + ], + "StartIdx": 5 + } + ] + } + }, + { + "name": "new", + "description": [ + "Creates a new Snail instance." + ], + "signature": "new() -\u003e @Snail", + "goFuncName": "snailnew", + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "run", + "description": [ + "Runs a shell command. Works the same as `hilbish.run`, but only accepts a table of streams." + ], + "signature": "run(command, streams)", + "goFuncName": "snailrun", + "isInterface": false, + "isMember": true, + "isType": false, + "params": [ + { + "Name": "command", + "Type": "string", + "Doc": [] + }, + { + "Name": "streams", + "Type": "table", + "Doc": [] + } + ], + "tags": { + "member": [ + { + "id": "", + "fields": null, + "StartIdx": 0 + } + ], + "param": [ + { + "id": "command", + "fields": [ + "string" + ], + "StartIdx": 3 + }, + { + "id": "streams", + "fields": [ + "table" + ], + "StartIdx": 0 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/defs/terminal.json b/defs/terminal.json new file mode 100644 index 00000000..8d783a39 --- /dev/null +++ b/defs/terminal.json @@ -0,0 +1,54 @@ +{ + "name": "terminal", + "shortDescription": "low level terminal library", + "description": "The terminal library is a simple and lower level library for certain terminal interactions.", + "properties": [], + "fields": [], + "docs": [ + { + "name": "restoreState", + "description": [ + "Restores the last saved state of the terminal" + ], + "signature": "restoreState()", + "goFuncName": "termrestorestate", + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "saveState", + "description": [ + "Saves the current state of the terminal." + ], + "signature": "saveState()", + "goFuncName": "termsavestate", + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "setRaw", + "description": [ + "Puts the terminal into raw mode." + ], + "signature": "setRaw()", + "goFuncName": "termsetraw", + "isInterface": false, + "isMember": false, + "isType": false + }, + { + "name": "size", + "description": [ + "Gets the dimensions of the terminal. Returns a table with `width` and `height`", + "NOTE: The size refers to the amount of columns and rows of text that can fit in the terminal." + ], + "signature": "size()", + "goFuncName": "termsize", + "isInterface": false, + "isMember": false, + "isType": false + } + ] +} \ No newline at end of file diff --git a/docs/api/bait.md b/docs/api/bait.md index 60b10567..a2ec9d07 100644 --- a/docs/api/bait.md +++ b/docs/api/bait.md @@ -9,6 +9,7 @@ menu: ## Introduction + Bait is the event emitter for Hilbish. Much like Node.js and its `events` system, many actions in Hilbish emit events. Unlike Node.js, Hilbish events are global. So make sure to @@ -33,98 +34,140 @@ What this does is, whenever the `command.exit` event is thrown, this function will set the user prompt. ## Functions -||| -|----|----| -|catch(name, cb)|Catches an event. This function can be used to act on events.| -|catchOnce(name, cb)|Catches an event, but only once. This will remove the hook immediately after it runs for the first time.| -|hooks(name) -> table|Returns a table of functions that are hooked on an event with the corresponding `name`.| -|release(name, catcher)|Removes the `catcher` for the event with `name`.| -|throw(name, ...args)|Throws a hook with `name` with the provided `args`.| -
+``` =html +
+
") + b.WriteString("") b.WriteString(col) b.WriteString("
+ + + + + + + + + + + + + + + + + + + + + + +
catch(name, cb)Catches an event. This function can be used to act on events.
catchOnce(name, cb)Catches an event, but only once. This will remove the hook immediately after it runs for the first time.
hooks(name) -> tableReturns a table of functions that are hooked on an event with the corresponding `name`.
release(name, catcher)Removes the `catcher` for the event with `name`.
throw(name, ...args)Throws a hook with `name` with the provided `args`.
+
+``` + +## Functions + +``` =html +
-

+

bait.catch(name, cb)

+``` + Catches an event. This function can be used to act on events. #### Parameters -`string` **`name`** + +`string` `*name*` The name of the hook. -`function` **`cb`** +`function` `*cb*` The function that will be called when the hook is thrown. #### Example + ```lua bait.catch('hilbish.exit', function() print 'Goodbye Hilbish!' end) ``` -
-
+ +``` =html +
-

+

bait.catchOnce(name, cb)

+``` + Catches an event, but only once. This will remove the hook immediately after it runs for the first time. #### Parameters -`string` **`name`** + +`string` `*name*` The name of the event -`function` **`cb`** +`function` `*cb*` The function that will be called when the event is thrown. -
-
+ +``` =html +
-

+

bait.hooks(name) -> table

+``` + Returns a table of functions that are hooked on an event with the corresponding `name`. #### Parameters -`string` **`name`** + +`string` `*name*` The name of the hook -
-
+ +``` =html +
-

+

bait.release(name, catcher)

+``` + Removes the `catcher` for the event with `name`. For this to work, `catcher` has to be the same function used to catch an event, like one saved to a variable. #### Parameters -`string` **`name`** + +`string` `*name*` Name of the event the hook is on -`function` **`catcher`** +`function` `*catcher*` Hook function to remove #### Example + ```lua local hookCallback = function() print 'hi' end @@ -134,27 +177,32 @@ bait.catch('event', hookCallback) bait.release('event', hookCallback) -- and now hookCallback will no longer be ran for the event. ``` -
-
+ +``` =html +
-

+

bait.throw(name, ...args)

+``` + Throws a hook with `name` with the provided `args`. #### Parameters -`string` **`name`** + +`string` `*name*` The name of the hook. -`any` **`args`** (This type is variadic. You can pass an infinite amount of parameters with this type.) +`any` `*args*` (This type is variadic. You can pass an infinite amount of parameters with this type.) The arguments to pass to the hook. #### Example + ```lua bait.throw('greeting', 'world') @@ -163,5 +211,5 @@ bait.catch('gretting', function(greetTo) print('Hello ' .. greetTo) end) ``` -
+ diff --git a/docs/api/commander.md b/docs/api/commander.md index b9107061..31a29c7d 100644 --- a/docs/api/commander.md +++ b/docs/api/commander.md @@ -9,6 +9,7 @@ menu: ## Introduction + Commander is the library which handles Hilbish commands. This makes the user able to add Lua-written commands to their shell without making a separate script in a bin folder. Instead, you may simply use the Commander @@ -29,7 +30,7 @@ have is: What is the `sinks` parameter? The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`. There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`) as `in` is also a Lua keyword, so `input` is preferred for use. -All of them are a Sink. +All of them are a @Sink. In the future, `sinks.in` will be removed. - `in` is the standard input. @@ -40,49 +41,76 @@ This is usually where command output should go. This sink is for writing errors, as the name would suggest. ## Functions -||| -|----|----| -|deregister(name)|Removes the named command. Note that this will only remove Commander-registered commands.| -|register(name, cb)|Adds a new command with the given `name`. When Hilbish has to run a command with a name,| -|registry() -> table|Returns all registered commanders. Returns a list of tables with the following keys:| -
+``` =html +
+ + + + + + + + + + + + + + + +
deregister(name)Removes the named command. Note that this will only remove Commander-registered commands.
register(name, cb)Adds a new command with the given `name`. When Hilbish has to run a command with a name,
registry() -> tableReturns all registered commanders. Returns a list of tables with the following keys:
+
+``` + +## Functions + +``` =html +
-

+

commander.deregister(name)

+``` + Removes the named command. Note that this will only remove Commander-registered commands. #### Parameters -`string` **`name`** + +`string` `*name*` Name of the command to remove. -
-
+ +``` =html +
-

+

commander.register(name, cb)

+``` + Adds a new command with the given `name`. When Hilbish has to run a command with a name, it will run the function providing the arguments and sinks. #### Parameters -`string` **`name`** + +`string` `*name*` Name of the command -`function` **`cb`** +`function` `*cb*` Callback to handle command invocation #### Example + ```lua -- When you run the command `hello` in the shell, it will print `Hello world`. -- If you run it with, for example, `hello Hilbish`, it will print 'Hello Hilbish' @@ -93,21 +121,25 @@ commander.register('hello', function(args, sinks) sinks.out:writeln('Hello ' .. name) end) ``` -
-
+ +``` =html +
-

+

commander.registry() -> table

+``` + Returns all registered commanders. Returns a list of tables with the following keys: - `exec`: The function used to run the commander. Commanders require args and sinks to be passed. #### Parameters -This function has no parameters. -
+ +This function has no parameters. + diff --git a/docs/api/fs.md b/docs/api/fs.md index 7b733ef2..db562a1a 100644 --- a/docs/api/fs.md +++ b/docs/api/fs.md @@ -9,117 +9,188 @@ menu: ## Introduction + The fs module provides filesystem functions to Hilbish. While Lua's standard library has some I/O functions, they're missing a lot of the basics. The `fs` library offers more functions and will work on any operating system Hilbish does. ## Functions -||| -|----|----| -|abs(path) -> string|Returns an absolute version of the `path`.| -|basename(path) -> string|Returns the "basename," or the last part of the provided `path`. If path is empty,| -|cd(dir)|Changes Hilbish's directory to `dir`.| -|dir(path) -> string|Returns the directory part of `path`. If a file path like| -|glob(pattern) -> matches (table)|Match all files based on the provided `pattern`.| -|join(...path) -> string|Takes any list of paths and joins them based on the operating system's path separator.| -|mkdir(name, recursive)|Creates a new directory with the provided `name`.| -|fpipe() -> File, File|Returns a pair of connected files, also known as a pipe.| -|readdir(path) -> table[string]|Returns a list of all files and directories in the provided path.| -|stat(path) -> {}|Returns the information about a given `path`.| + +``` =html +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
abs(path) -> stringReturns an absolute version of the `path`.
basename(path) -> stringReturns the "basename," or the last part of the provided `path`. If path is empty,
cd(dir)Changes Hilbish's directory to `dir`.
dir(path) -> stringReturns the directory part of `path`. If a file path like
glob(pattern) -> matches (table)Match all files based on the provided `pattern`.
join(...path) -> stringTakes any list of paths and joins them based on the operating system's path separator.
mkdir(name, recursive)Creates a new directory with the provided `name`.
fpipe() -> File, FileReturns a pair of connected files, also known as a pipe.
readdir(path) -> table[string]Returns a list of all files and directories in the provided path.
stat(path) -> {}Returns the information about a given `path`.
+
+``` ## Static module fields -||| -|----|----| -|pathSep|The operating system's path separator.| -
+``` =html +
+ + + + + + + +
pathSepThe operating system's path separator.
+
+``` + +## Functions + +``` =html +
-

+

fs.abs(path) -> string

+``` + Returns an absolute version of the `path`. This can be used to resolve short paths like `..` to `/home/user`. #### Parameters -`string` **`path`** + +`string` `*path*` -
-
+ +``` =html +
-

+

fs.basename(path) -> string

+``` + Returns the "basename," or the last part of the provided `path`. If path is empty, `.` will be returned. #### Parameters -`string` **`path`** + +`string` `*path*` Path to get the base name of. -
-
+ +``` =html +
-

+

fs.cd(dir)

+``` + Changes Hilbish's directory to `dir`. #### Parameters -`string` **`dir`** + +`string` `*dir*` Path to change directory to. -
-
+ +``` =html +
-

+

fs.dir(path) -> string

+``` + Returns the directory part of `path`. If a file path like `~/Documents/doc.txt` then this function will return `~/Documents`. #### Parameters -`string` **`path`** + +`string` `*path*` Path to get the directory for. -
-
+ +``` =html +
-

+

fs.glob(pattern) -> matches (table)

+``` + Match all files based on the provided `pattern`. For the syntax' refer to Go's filepath.Match function: https://pkg.go.dev/path/filepath#Match #### Parameters -`string` **`pattern`** + +`string` `*pattern*` Pattern to compare files with. #### Example + ```lua --[[ Within a folder that contains the following files: @@ -132,100 +203,121 @@ local matches = fs.glob './*.lua' print(matches) -- -> {'init.lua', 'code.lua'} ``` -
-
+ +``` =html +
-

+

fs.join(...path) -> string

+``` + Takes any list of paths and joins them based on the operating system's path separator. #### Parameters -`string` **`path`** (This type is variadic. You can pass an infinite amount of parameters with this type.) + +`string` `*path*` (This type is variadic. You can pass an infinite amount of parameters with this type.) Paths to join together #### Example + ```lua -- This prints the directory for Hilbish's config! print(fs.join(hilbish.userDir.config, 'hilbish')) -- -> '/home/user/.config/hilbish' on Linux ``` -
-
+ +``` =html +
-

+

fs.mkdir(name, recursive)

+``` + Creates a new directory with the provided `name`. With `recursive`, mkdir will create parent directories. #### Parameters -`string` **`name`** + +`string` `*name*` Name of the directory -`boolean` **`recursive`** +`boolean` `*recursive*` Whether to create parent directories for the provided name #### Example + ```lua -- This will create the directory foo, then create the directory bar in the -- foo directory. If recursive is false in this case, it will fail. fs.mkdir('./foo/bar', true) ``` -
-
+ +``` =html +
-

+

fs.fpipe() -> File, File

+``` + Returns a pair of connected files, also known as a pipe. The type returned is a Lua file, same as returned from `io` functions. #### Parameters -This function has no parameters. -
-
+This function has no parameters. + + +``` =html +
-

+

fs.readdir(path) -> table[string]

+``` + Returns a list of all files and directories in the provided path. #### Parameters -`string` **`dir`** + +`string` `*dir*` -
-
+ +``` =html +
-

+

fs.stat(path) -> {}

+``` + Returns the information about a given `path`. The returned table contains the following values: name (string) - Name of the path @@ -234,10 +326,12 @@ mode (string) - Unix permission mode in an octal format string (with leading 0) isDir (boolean) - If the path is a directory #### Parameters -`string` **`path`** + +`string` `*path*` #### Example + ```lua local inspect = require 'inspect' @@ -253,5 +347,5 @@ Would print the following: } ]]-- ``` -
+ diff --git a/docs/api/hilbish.md b/docs/api/hilbish.md index 909168e2..93424e2b 100644 --- a/docs/api/hilbish.md +++ b/docs/api/hilbish.md @@ -1,6 +1,6 @@ --- title: Module hilbish -description: +description: the core Hilbish API layout: doc menu: docs: @@ -9,100 +9,153 @@ menu: ## Introduction - +The Hilbish module includes the core API, containing +interfaces and functions which directly relate to shell functionality. ## Functions ``` =html -
- +
+
- - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
alias(cmd, orig)Sets an alias, with a name of `cmd` to another command.
alias(cmd, orig)Sets an alias, with a name of `cmd` to another command.
appendPath(dir)Appends the provided dir to the command path (`$PATH`)
appendPath(dir)Appends the provided dir to the command path (`$PATH`)
complete(scope, cb)Registers a completion handler for the specified scope.
complete(scope, cb)Registers a completion handler for the specified scope.
cwd() -> stringReturns the current directory of the shell.
cwd() -> stringReturns the current directory of the shell.
exec(cmd)Replaces the currently running Hilbish instance with the supplied command.
exec(cmd)Replaces the currently running Hilbish instance with the supplied command.
goro(fn)Puts `fn` in a Goroutine.
goro(fn)Puts `fn` in a Goroutine.
highlighter(line)Line highlighter handler.
highlighter(line)Line highlighter handler.
hinter(line, pos)The command line hint handler. It gets called on every key insert to
hinter(line, pos)The command line hint handler. It gets called on every key insert to
inputMode(mode)Sets the input mode for Hilbish's line reader.
inputMode(mode)Sets the input mode for Hilbish's line reader.
interval(cb, time) -> @TimerRuns the `cb` function every specified amount of `time`.
interval(cb, time) -> @TimerRuns the `cb` function every specified amount of `time`.
multiprompt(str)Changes the text prompt when Hilbish asks for more input.
multiprompt(str)Changes the text prompt when Hilbish asks for more input.
prependPath(dir)Prepends `dir` to $PATH.
prependPath(dir)Prepends `dir` to $PATH.
prompt(str, typ)Changes the shell prompt to the provided string.
prompt(str, typ)Changes the shell prompt to the provided string.
read(prompt) -> input (string)Read input from the user, using Hilbish's line editor/input reader.
read(prompt) -> input (string)Read input from the user, using Hilbish's line editor/input reader.
timeout(cb, time) -> @TimerExecuted the `cb` function after a period of `time`.
timeout(cb, time) -> @TimerExecuted the `cb` function after a period of `time`.
which(name) -> stringChecks if `name` is a valid command.
which(name) -> stringChecks if `name` is a valid command.
``` -
+## Static module fields + +``` =html +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
verThe version of Hilbish
goVersionThe version of Go that Hilbish was compiled with
userUsername of the user
hostHostname of the machine
dataDirDirectory for Hilbish data files, including the docs and default modules
interactiveIs Hilbish in an interactive shell?
loginIs Hilbish the login shell?
vimModeCurrent Vim input mode of Hilbish (will be nil if not in Vim input mode)
exitCodeExit code of the last executed command
+
+``` + +## Functions + +``` =html +
-

+

hilbish.alias(cmd, orig)

+``` + Sets an alias, with a name of `cmd` to another command. #### Parameters -`string` *`cmd`* +`string` `*cmd*` Name of the alias -`string` *`orig`* +`string` `*orig*` Command that will be aliased #### Example @@ -115,22 +168,25 @@ hilbish.alias('ga', 'git add') hilbish.alias('dircount', 'ls %1 | wc -l') -- "dircount ~" would count how many files are in ~ (home directory). ``` -
-
+ +``` =html +
-

+

hilbish.appendPath(dir)

+``` + Appends the provided dir to the command path (`$PATH`) #### Parameters -`string|table` *`dir`* +`string|table` `*dir*` Directory (or directories) to append to path #### Example @@ -145,17 +201,20 @@ hilbish.appendPath { '~/.local/bin' } ``` -
-
+ +``` =html +
-

+

hilbish.complete(scope, cb)

+``` + Registers a completion handler for the specified scope. A `scope` is expected to be `command.`, replacing with the name of the command (for example `command.git`). @@ -164,10 +223,10 @@ provides more details. #### Parameters -`string` *`scope`* +`string` `*scope*` -`function` *`cb`* +`function` `*cb*` #### Example @@ -197,52 +256,61 @@ hilbish.complete('command.sudo', function(query, ctx, fields) return {compGroup}, pfx end) ``` -
-
+ +``` =html +
-

+

hilbish.cwd() -> string

+``` + Returns the current directory of the shell. #### Parameters This function has no parameters. -
-
+ +``` =html +
-

+

hilbish.exec(cmd)

+``` + Replaces the currently running Hilbish instance with the supplied command. This can be used to do an in-place restart. #### Parameters -`string` *`cmd`* +`string` `*cmd*` -
-
+ +``` =html +
-

+

hilbish.goro(fn)

+``` + Puts `fn` in a Goroutine. This can be used to run any function in another thread at the same time as other Lua code. **NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.** @@ -250,20 +318,23 @@ This can be used to run any function in another thread at the same time as other #### Parameters -`function` *`fn`* +`function` `*fn*` -
-
+ +``` =html +
-

+

hilbish.highlighter(line)

+``` + Line highlighter handler. This is mainly for syntax highlighting, but in reality could set the input of the prompt to *display* anything. The callback is passed the current line @@ -272,7 +343,7 @@ Note that to set a highlighter, one has to override this function. #### Parameters -`string` *`line`* +`string` `*line*` #### Example @@ -283,17 +354,20 @@ function hilbish.highlighter(line) return line:gsub('"%w+"', function(c) return lunacolors.green(c) end) end ``` -
-
+ +``` =html +
-

+

hilbish.hinter(line, pos)

+``` + The command line hint handler. It gets called on every key insert to determine what text to use as an inline hint. It is passed the current line and cursor position. It is expected to return a string which is used @@ -302,10 +376,10 @@ override this function with your custom handler. #### Parameters -`string` *`line`* +`string` `*line*` -`number` *`pos`* +`number` `*pos*` Position of cursor in line. Usually equals string.len(line) #### Example @@ -316,65 +390,74 @@ function hilbish.hinter(line, pos) return 'hi' end ``` -
-
+ +``` =html +
-

+

hilbish.inputMode(mode)

+``` + Sets the input mode for Hilbish's line reader. `emacs` is the default. Setting it to `vim` changes behavior of input to be Vim-like with modes and Vim keybinds. #### Parameters -`string` *`mode`* +`string` `*mode*` Can be set to either `emacs` or `vim` -
-
+ +``` =html +
-

-hilbish.interval(cb, time) -> Timer +

+hilbish.interval(cb, time) -> @Timer

+``` + Runs the `cb` function every specified amount of `time`. This creates a timer that ticking immediately. #### Parameters -`function` *`cb`* +`function` `*cb*` -`number` *`time`* +`number` `*time*` Time in milliseconds. -
-
+ +``` =html +
-

+

hilbish.multiprompt(str)

+``` + Changes the text prompt when Hilbish asks for more input. This will show up when text is incomplete, like a missing quote #### Parameters -`string` *`str`* +`string` `*str*` #### Example @@ -396,35 +479,41 @@ hey ...! ]]-- hilbish.multiprompt '-->' ``` -
-
+ +``` =html +
-

+

hilbish.prependPath(dir)

+``` + Prepends `dir` to $PATH. #### Parameters -`string` *`dir`* +`string` `*dir*` -
-
+ +``` =html +
-

+

hilbish.prompt(str, typ)

+``` + Changes the shell prompt to the provided string. There are a few verbs that can be used in the prompt text. These will be formatted and replaced with the appropriate values. @@ -434,10 +523,10 @@ These will be formatted and replaced with the appropriate values. #### Parameters -`string` *`str`* +`string` `*str*` -`string` *`typ?`* +`string` `*typ?*` Type of prompt, being left or right. Left by default. #### Example @@ -449,72 +538,83 @@ hilbish.prompt '%u %d ∆' hilbish.prompt '%u@%h :%d $' -- prompt: user@hostname: ~/directory $ ``` -
-
+ +``` =html +
-

+

hilbish.read(prompt) -> input (string)

+``` + Read input from the user, using Hilbish's line editor/input reader. This is a separate instance from the one Hilbish actually uses. Returns `input`, will be nil if Ctrl-D is pressed, or an error occurs. #### Parameters -`string` *`prompt?`* +`string` `*prompt?*` Text to print before input, can be empty. -
-
+ +``` =html +
-

-hilbish.timeout(cb, time) -> Timer +

+hilbish.timeout(cb, time) -> @Timer

+``` + Executed the `cb` function after a period of `time`. This creates a Timer that starts ticking immediately. #### Parameters -`function` *`cb`* +`function` `*cb*` -`number` *`time`* +`number` `*time*` Time to run in milliseconds. -
-
+ +``` =html +
-

+

hilbish.which(name) -> string

+``` + Checks if `name` is a valid command. Will return the path of the binary, or a basename if it's a commander. #### Parameters -`string` *`name`* +`string` `*name*` + -
## Types -
+``` =html +
+``` ## Sink diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md deleted file mode 100644 index 5aa7045b..00000000 --- a/docs/api/hilbish/_index.md +++ /dev/null @@ -1,539 +0,0 @@ ---- -title: Module hilbish -description: the core Hilbish API -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -The Hilbish module includes the core API, containing -interfaces and functions which directly relate to shell functionality. - -## Functions -||| -|----|----| -|alias(cmd, orig)|Sets an alias, with a name of `cmd` to another command.| -|appendPath(dir)|Appends the provided dir to the command path (`$PATH`)| -|complete(scope, cb)|Registers a completion handler for the specified scope.| -|cwd() -> string|Returns the current directory of the shell.| -|exec(cmd)|Replaces the currently running Hilbish instance with the supplied command.| -|goro(fn)|Puts `fn` in a Goroutine.| -|highlighter(line)|Line highlighter handler.| -|hinter(line, pos)|The command line hint handler. It gets called on every key insert to| -|inputMode(mode)|Sets the input mode for Hilbish's line reader.| -|interval(cb, time) -> @Timer|Runs the `cb` function every specified amount of `time`.| -|multiprompt(str)|Changes the text prompt when Hilbish asks for more input.| -|prependPath(dir)|Prepends `dir` to $PATH.| -|prompt(str, typ)|Changes the shell prompt to the provided string.| -|read(prompt) -> input (string)|Read input from the user, using Hilbish's line editor/input reader.| -|timeout(cb, time) -> @Timer|Executed the `cb` function after a period of `time`.| -|which(name) -> string|Checks if `name` is a valid command.| -|runnerMode(mode)|Sets the execution/runner mode for interactive Hilbish.| -|run(cmd, streams)|Runs `cmd` in Hilbish's shell script interpreter.| - -## Static module fields -||| -|----|----| -|ver|The version of Hilbish| -|goVersion|The version of Go that Hilbish was compiled with| -|user|Username of the user| -|host|Hostname of the machine| -|dataDir|Directory for Hilbish data files, including the docs and default modules| -|interactive|Is Hilbish in an interactive shell?| -|login|Is Hilbish the login shell?| -|vimMode|Current Vim input mode of Hilbish (will be nil if not in Vim input mode)| -|exitCode|Exit code of the last executed command| - -
-
-

-hilbish.alias(cmd, orig) - - - -

- -Sets an alias, with a name of `cmd` to another command. - -#### Parameters -`string` **`cmd`** -Name of the alias - -`string` **`orig`** -Command that will be aliased - -#### Example -```lua --- With this, "ga file" will turn into "git add file" -hilbish.alias('ga', 'git add') - --- Numbered substitutions are supported here! -hilbish.alias('dircount', 'ls %1 | wc -l') --- "dircount ~" would count how many files are in ~ (home directory). -``` -
- -
-
-

-hilbish.appendPath(dir) - - - -

- -Appends the provided dir to the command path (`$PATH`) - -#### Parameters -`string|table` **`dir`** -Directory (or directories) to append to path - -#### Example -```lua -hilbish.appendPath '~/go/bin' --- Will add ~/go/bin to the command path. - --- Or do multiple: -hilbish.appendPath { - '~/go/bin', - '~/.local/bin' -} -``` -
- -
-
-

-hilbish.complete(scope, cb) - - - -

- -Registers a completion handler for the specified scope. -A `scope` is expected to be `command.`, -replacing with the name of the command (for example `command.git`). -The documentation for completions, under Features/Completions or `doc completions` -provides more details. - -#### Parameters -`string` **`scope`** - - -`function` **`cb`** - - -#### Example -```lua --- This is a very simple example. Read the full doc for completions for details. -hilbish.complete('command.sudo', function(query, ctx, fields) - if #fields == 0 then - -- complete for commands - local comps, pfx = hilbish.completion.bins(query, ctx, fields) - local compGroup = { - items = comps, -- our list of items to complete - type = 'grid' -- what our completions will look like. - } - - return {compGroup}, pfx - end - - -- otherwise just be boring and return files - - local comps, pfx = hilbish.completion.files(query, ctx, fields) - local compGroup = { - items = comps, - type = 'grid' - } - - return {compGroup}, pfx -end) -``` -
- -
-
-

-hilbish.cwd() -> string - - - -

- -Returns the current directory of the shell. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.exec(cmd) - - - -

- -Replaces the currently running Hilbish instance with the supplied command. -This can be used to do an in-place restart. - -#### Parameters -`string` **`cmd`** - - -
- -
-
-

-hilbish.goro(fn) - - - -

- -Puts `fn` in a Goroutine. -This can be used to run any function in another thread at the same time as other Lua code. -**NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.** -**This is a limitation of the Lua runtime.** - -#### Parameters -`function` **`fn`** - - -
- -
-
-

-hilbish.highlighter(line) - - - -

- -Line highlighter handler. -This is mainly for syntax highlighting, but in reality could set the input -of the prompt to *display* anything. The callback is passed the current line -and is expected to return a line that will be used as the input display. -Note that to set a highlighter, one has to override this function. - -#### Parameters -`string` **`line`** - - -#### Example -```lua ---This code will highlight all double quoted strings in green. -function hilbish.highlighter(line) - return line:gsub('"%w+"', function(c) return lunacolors.green(c) end) -end -``` -
- -
-
-

-hilbish.hinter(line, pos) - - - -

- -The command line hint handler. It gets called on every key insert to -determine what text to use as an inline hint. It is passed the current -line and cursor position. It is expected to return a string which is used -as the text for the hint. This is by default a shim. To set hints, -override this function with your custom handler. - -#### Parameters -`string` **`line`** - - -`number` **`pos`** -Position of cursor in line. Usually equals string.len(line) - -#### Example -```lua --- this will display "hi" after the cursor in a dimmed color. -function hilbish.hinter(line, pos) - return 'hi' -end -``` -
- -
-
-

-hilbish.inputMode(mode) - - - -

- -Sets the input mode for Hilbish's line reader. -`emacs` is the default. Setting it to `vim` changes behavior of input to be -Vim-like with modes and Vim keybinds. - -#### Parameters -`string` **`mode`** -Can be set to either `emacs` or `vim` - -
- -
-
-

-hilbish.interval(cb, time) -> Timer - - - -

- -Runs the `cb` function every specified amount of `time`. -This creates a timer that ticking immediately. - -#### Parameters -`function` **`cb`** - - -`number` **`time`** -Time in milliseconds. - -
- -
-
-

-hilbish.multiprompt(str) - - - -

- -Changes the text prompt when Hilbish asks for more input. -This will show up when text is incomplete, like a missing quote - -#### Parameters -`string` **`str`** - - -#### Example -```lua ---[[ -imagine this is your text input: -user ~ ∆ echo "hey - -but there's a missing quote! hilbish will now prompt you so the terminal -will look like: -user ~ ∆ echo "hey ---> ...!" - -so then you get -user ~ ∆ echo "hey ---> ...!" -hey ...! -]]-- -hilbish.multiprompt '-->' -``` -
- -
-
-

-hilbish.prependPath(dir) - - - -

- -Prepends `dir` to $PATH. - -#### Parameters -`string` **`dir`** - - -
- -
-
-

-hilbish.prompt(str, typ) - - - -

- -Changes the shell prompt to the provided string. -There are a few verbs that can be used in the prompt text. -These will be formatted and replaced with the appropriate values. -`%d` - Current working directory -`%u` - Name of current user -`%h` - Hostname of device - -#### Parameters -`string` **`str`** - - -`string` **`typ?`** -Type of prompt, being left or right. Left by default. - -#### Example -```lua --- the default hilbish prompt without color -hilbish.prompt '%u %d ∆' --- or something of old: -hilbish.prompt '%u@%h :%d $' --- prompt: user@hostname: ~/directory $ -``` -
- -
-
-

-hilbish.read(prompt) -> input (string) - - - -

- -Read input from the user, using Hilbish's line editor/input reader. -This is a separate instance from the one Hilbish actually uses. -Returns `input`, will be nil if Ctrl-D is pressed, or an error occurs. - -#### Parameters -`string` **`prompt?`** -Text to print before input, can be empty. - -
- -
-
-

-hilbish.timeout(cb, time) -> Timer - - - -

- -Executed the `cb` function after a period of `time`. -This creates a Timer that starts ticking immediately. - -#### Parameters -`function` **`cb`** - - -`number` **`time`** -Time to run in milliseconds. - -
- -
-
-

-hilbish.which(name) -> string - - - -

- -Checks if `name` is a valid command. -Will return the path of the binary, or a basename if it's a commander. - -#### Parameters -`string` **`name`** - - -
- -## Types -
- -## Sink -A sink is a structure that has input and/or output to/from a desination. - -### Methods -#### autoFlush(auto) -Sets/toggles the option of automatically flushing output. -A call with no argument will toggle the value. - -#### flush() -Flush writes all buffered input to the sink. - -#### read() -> string -Reads a liine of input from the sink. - -#### readAll() -> string -Reads all input from the sink. - -#### write(str) -Writes data to a sink. - -#### writeln(str) -Writes data to a sink with a newline at the end. - -
-
-

-hilbish.run(cmd, streams) - - - -

- -Runs `cmd` in Hilbish's shell script interpreter. -The `streams` parameter specifies the output and input streams the command should use. -For example, to write command output to a sink. -As a table, the caller can directly specify the standard output, error, and input -streams of the command with the table keys `out`, `err`, and `input` respectively. -As a boolean, it specifies whether the command should use standard output or return its output streams. -#### Parameters -`cmd` **`string`** - - -`streams` **`table|boolean`** - - -#### Example -```lua --- This code is the same as `ls -l | wc -l` -local fs = require 'fs' -local pr, pw = fs.pipe() -hilbish.run('ls -l', { - stdout = pw, - stderr = pw, -}) -pw:close() -hilbish.run('wc -l', { - stdin = pr -}) -``` -
- -
-
-

-hilbish.runnerMode(mode) - - - -

- -Sets the execution/runner mode for interactive Hilbish. -**NOTE: This function is deprecated and will be removed in 3.0** -Use `hilbish.runner.setCurrent` instead. -This determines whether Hilbish wll try to run input as Lua -and/or sh or only do one of either. -Accepted values for mode are hybrid (the default), hybridRev (sh first then Lua), -sh, and lua. It also accepts a function, to which if it is passed one -will call it to execute user input instead. -Read [about runner mode](../features/runner-mode) for more information. -#### Parameters -`mode` **`string|function`** - - -
- diff --git a/docs/api/hilbish/hilbish.abbr.md b/docs/api/hilbish/hilbish.abbr.md deleted file mode 100644 index 8e88c190..00000000 --- a/docs/api/hilbish/hilbish.abbr.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: Module hilbish.abbr -description: command line abbreviations -layout: doc -menu: - docs: - parent: "API" ---- - - -## Introduction -The abbr module manages Hilbish abbreviations. These are words that can be replaced -with longer command line strings when entered. -As an example, `git push` can be abbreviated to `gp`. When the user types -`gp` into the command line, after hitting space or enter, it will expand to `git push`. -Abbreviations can be used as an alternative to aliases. They are saved entirely in the history -Instead of the aliased form of the same command. - -## Functions -||| -|----|----| -|remove(abbr)|Removes the named `abbr`.| -|add(abbr, expanded|function, opts)|Adds an abbreviation. The `abbr` is the abbreviation itself,| -
-
-

-hilbish.abbr.add(abbr, expanded|function, opts) - - - -

- -Adds an abbreviation. The `abbr` is the abbreviation itself, -while `expanded` is what the abbreviation should expand to. -It can be either a function or a string. If it is a function, it will expand to what -the function returns. -`opts` is a table that accepts 1 key: `anywhere`. -`opts.anywhere` defines whether the abbr expands anywhere in the command line or not, -whereas the default behavior is only at the beginning of the line -#### Parameters -`abbr` **`string`** - - -`expanded|function` **`string`** - - -`opts` **`table`** - - -
- -
-
-

-hilbish.abbr.remove(abbr) - - - -

- -Removes the named `abbr`. -#### Parameters -`abbr` **`string`** - - -
- diff --git a/docs/api/hilbish/hilbish.aliases.md b/docs/api/hilbish/hilbish.aliases.md deleted file mode 100644 index e0a6f482..00000000 --- a/docs/api/hilbish/hilbish.aliases.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Module hilbish.aliases -description: command aliasing -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -The alias interface deals with all command aliases in Hilbish. - -## Functions -||| -|----|----| -|add(alias, cmd)|This is an alias (ha) for the [hilbish.alias](../#alias) function.| -|delete(name)|Removes an alias.| -|list() -> table[string, string]|Get a table of all aliases, with string keys as the alias and the value as the command.| -|resolve(alias) -> string?|Resolves an alias to its original command. Will thrown an error if the alias doesn't exist.| - -
-
-

-hilbish.aliases.add(alias, cmd) - - - -

- -This is an alias (ha) for the [hilbish.alias](../#alias) function. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.aliases.delete(name) - - - -

- -Removes an alias. - -#### Parameters -`string` **`name`** - - -
- -
-
-

-hilbish.aliases.list() -> table[string, string] - - - -

- -Get a table of all aliases, with string keys as the alias and the value as the command. - -#### Parameters -This function has no parameters. -#### Example -```lua -hilbish.aliases.add('hi', 'echo hi') - -local aliases = hilbish.aliases.list() --- -> {hi = 'echo hi'} -``` -
- -
-
-

-hilbish.aliases.resolve(alias) -> string? - - - -

- -Resolves an alias to its original command. Will thrown an error if the alias doesn't exist. - -#### Parameters -`string` **`alias`** - - -
- diff --git a/docs/api/hilbish/hilbish.completion.md b/docs/api/hilbish/hilbish.completion.md deleted file mode 100644 index be6c0941..00000000 --- a/docs/api/hilbish/hilbish.completion.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -title: Module hilbish.completion -description: tab completions -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -The completions interface deals with tab completions. - -## Functions -||| -|----|----| -|bins(query, ctx, fields) -> entries (table), prefix (string)|Return binaries/executables based on the provided parameters.| -|call(name, query, ctx, fields) -> completionGroups (table), prefix (string)|Calls a completer function. This is mainly used to call a command completer, which will have a `name`| -|files(query, ctx, fields) -> entries (table), prefix (string)|Returns file matches based on the provided parameters.| -|handler(line, pos)|This function contains the general completion handler for Hilbish. This function handles| - -
-
-

-hilbish.completion.bins(query, ctx, fields) -> entries (table), prefix (string) - - - -

- -Return binaries/executables based on the provided parameters. -This function is meant to be used as a helper in a command completion handler. - -#### Parameters -`string` **`query`** - - -`string` **`ctx`** - - -`table` **`fields`** - - -#### Example -```lua --- an extremely simple completer for sudo. -hilbish.complete('command.sudo', function(query, ctx, fields) - table.remove(fields, 1) - if #fields[1] then - -- return commands because sudo runs a command as root..! - - local entries, pfx = hilbish.completion.bins(query, ctx, fields) - return { - type = 'grid', - items = entries - }, pfx - end - - -- ... else suggest files or anything else .. -end) -``` -
- -
-
-

-hilbish.completion.call(name, query, ctx, fields) -> completionGroups (table), prefix (string) - - - -

- -Calls a completer function. This is mainly used to call a command completer, which will have a `name` -in the form of `command.name`, example: `command.git`. -You can check the Completions doc or `doc completions` for info on the `completionGroups` return value. - -#### Parameters -`string` **`name`** - - -`string` **`query`** - - -`string` **`ctx`** - - -`table` **`fields`** - - -
- -
-
-

-hilbish.completion.files(query, ctx, fields) -> entries (table), prefix (string) - - - -

- -Returns file matches based on the provided parameters. -This function is meant to be used as a helper in a command completion handler. - -#### Parameters -`string` **`query`** - - -`string` **`ctx`** - - -`table` **`fields`** - - -
- -
-
-

-hilbish.completion.handler(line, pos) - - - -

- -This function contains the general completion handler for Hilbish. This function handles -completion of everything, which includes calling other command handlers, binaries, and files. -This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function. - -#### Parameters -`string` **`line`** -The current Hilbish command line - -`number` **`pos`** -Numerical position of the cursor - -#### Example -```lua --- stripped down version of the default implementation -function hilbish.completion.handler(line, pos) - local query = fields[#fields] - - if #fields == 1 then - -- call bins handler here - else - -- call command completer or files completer here - end -end -``` -
- diff --git a/docs/api/hilbish/hilbish.editor.md b/docs/api/hilbish/hilbish.editor.md deleted file mode 100644 index 6dac64b8..00000000 --- a/docs/api/hilbish/hilbish.editor.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Module hilbish.editor -description: interactions for Hilbish's line reader -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -The hilbish.editor interface provides functions to -directly interact with the line editor in use. - -## Functions -||| -|----|----| -|deleteByAmount(amount)|Deletes characters in the line by the given amount.| -|getLine() -> string|Returns the current input line.| -|getVimRegister(register) -> string|Returns the text that is at the register.| -|insert(text)|Inserts text into the Hilbish command line.| -|getChar() -> string|Reads a keystroke from the user. This is in a format of something like Ctrl-L.| -|setVimRegister(register, text)|Sets the vim register at `register` to hold the passed text.| - -
-
-

-hilbish.editor.deleteByAmount(amount) - - - -

- -Deletes characters in the line by the given amount. - -#### Parameters -`number` **`amount`** - - -
- -
-
-

-hilbish.editor.getLine() -> string - - - -

- -Returns the current input line. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.editor.getVimRegister(register) -> string - - - -

- -Returns the text that is at the register. - -#### Parameters -`string` **`register`** - - -
- -
-
-

-hilbish.editor.insert(text) - - - -

- -Inserts text into the Hilbish command line. - -#### Parameters -`string` **`text`** - - -
- -
-
-

-hilbish.editor.getChar() -> string - - - -

- -Reads a keystroke from the user. This is in a format of something like Ctrl-L. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.editor.setVimRegister(register, text) - - - -

- -Sets the vim register at `register` to hold the passed text. - -#### Parameters -`string` **`register`** - - -`string` **`text`** - - -
- diff --git a/docs/api/hilbish/hilbish.history.md b/docs/api/hilbish/hilbish.history.md deleted file mode 100644 index 6de9bdf4..00000000 --- a/docs/api/hilbish/hilbish.history.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Module hilbish.history -description: command history -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -The history interface deals with command history. -This includes the ability to override functions to change the main -method of saving history. - -## Functions -||| -|----|----| -|add(cmd)|Adds a command to the history.| -|all() -> table|Retrieves all history as a table.| -|clear()|Deletes all commands from the history.| -|get(index)|Retrieves a command from the history based on the `index`.| -|size() -> number|Returns the amount of commands in the history.| - -
-
-

-hilbish.history.add(cmd) - - - -

- -Adds a command to the history. - -#### Parameters -`string` **`cmd`** - - -
- -
-
-

-hilbish.history.all() -> table - - - -

- -Retrieves all history as a table. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.history.clear() - - - -

- -Deletes all commands from the history. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.history.get(index) - - - -

- -Retrieves a command from the history based on the `index`. - -#### Parameters -`number` **`index`** - - -
- -
-
-

-hilbish.history.size() -> number - - - -

- -Returns the amount of commands in the history. - -#### Parameters -This function has no parameters. -
- diff --git a/docs/api/hilbish/hilbish.jobs.md b/docs/api/hilbish/hilbish.jobs.md deleted file mode 100644 index fe3978f6..00000000 --- a/docs/api/hilbish/hilbish.jobs.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: Module hilbish.jobs -description: background job management -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction - -Manage interactive jobs in Hilbish via Lua. - -Jobs are the name of background tasks/commands. A job can be started via -interactive usage or with the functions defined below for use in external runners. - -## Functions -||| -|----|----| -|add(cmdstr, args, execPath)|Creates a new job. This function does not run the job. This function is intended to be| -|all() -> table[@Job]|Returns a table of all job objects.| -|disown(id)|Disowns a job. This simply deletes it from the list of jobs without stopping it.| -|get(id) -> @Job|Get a job object via its ID.| -|last() -> @Job|Returns the last added job to the table.| - -
-
-

-hilbish.jobs.add(cmdstr, args, execPath) - - - -

- -Creates a new job. This function does not run the job. This function is intended to be -used by runners, but can also be used to create jobs via Lua. Commanders cannot be ran as jobs. - -#### Parameters -`string` **`cmdstr`** -String that a user would write for the job - -`table` **`args`** -Arguments for the commands. Has to include the name of the command. - -`string` **`execPath`** -Binary to use to run the command. Needs to be an absolute path. - -#### Example -```lua -hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go') -``` -
- -
-
-

-hilbish.jobs.all() -> table[Job] - - - -

- -Returns a table of all job objects. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.jobs.disown(id) - - - -

- -Disowns a job. This simply deletes it from the list of jobs without stopping it. - -#### Parameters -`number` **`id`** - - -
- -
-
-

-hilbish.jobs.get(id) -> Job - - - -

- -Get a job object via its ID. - -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.jobs.last() -> Job - - - -

- -Returns the last added job to the table. - -#### Parameters -This function has no parameters. -
- -## Types -
- -## Job -The Job type describes a Hilbish job. -## Object properties -||| -|----|----| -|cmd|The user entered command string for the job.| -|running|Whether the job is running or not.| -|id|The ID of the job in the job table| -|pid|The Process ID| -|exitCode|The last exit code of the job.| -|stdout|The standard output of the job. This just means the normal logs of the process.| -|stderr|The standard error stream of the process. This (usually) includes error messages of the job.| - - -### Methods -#### background() -Puts a job in the background. This acts the same as initially running a job. - -#### foreground() -Puts a job in the foreground. This will cause it to run like it was -executed normally and wait for it to complete. - -#### start() -Starts running the job. - -#### stop() -Stops the job from running. - diff --git a/docs/api/hilbish/hilbish.messages.md b/docs/api/hilbish/hilbish.messages.md deleted file mode 100644 index 705cfa2c..00000000 --- a/docs/api/hilbish/hilbish.messages.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Module hilbish.messages -description: simplistic message passing -layout: doc -menu: - docs: - parent: "API" ---- - - -## Introduction -The messages interface defines a way for Hilbish-integrated commands, -user config and other tasks to send notifications to alert the user.z -The `hilbish.message` type is a table with the following keys: -`title` (string): A title for the message notification. -`text` (string): The contents of the message. -`channel` (string): States the origin of the message, `hilbish.*` is reserved for Hilbish tasks. -`summary` (string): A short summary of the `text`. -`icon` (string): Unicode (preferably standard emoji) icon for the message notification -`read` (boolean): Whether the full message has been read or not. - -## Functions -||| -|----|----| -|unreadCount()|Returns the amount of unread messages.| -|send(message)|Sends a message.| -|readAll()|Marks all messages as read.| -|read(idx)|Marks a message at `idx` as read.| -|delete(idx)|Deletes the message at `idx`.| -|clear()|Deletes all messages.| -|all()|Returns all messages.| -
-
-

-hilbish.messages.all() - - - -

- -Returns all messages. -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.messages.clear() - - - -

- -Deletes all messages. -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.messages.delete(idx) - - - -

- -Deletes the message at `idx`. -#### Parameters -`idx` **`number`** - - -
- -
-
-

-hilbish.messages.read(idx) - - - -

- -Marks a message at `idx` as read. -#### Parameters -`idx` **`number`** - - -
- -
-
-

-hilbish.messages.readAll() - - - -

- -Marks all messages as read. -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.messages.send(message) - - - -

- -Sends a message. -#### Parameters -`message` **`hilbish.message`** - - -
- -
-
-

-hilbish.messages.unreadCount() - - - -

- -Returns the amount of unread messages. -#### Parameters -This function has no parameters. -
- diff --git a/docs/api/hilbish/hilbish.module.md b/docs/api/hilbish/hilbish.module.md deleted file mode 100644 index 4029d7a7..00000000 --- a/docs/api/hilbish/hilbish.module.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Module hilbish.module -description: native module loading -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction - -The hilbish.module interface provides a function to load -Hilbish plugins/modules. Hilbish modules are Go-written -plugins (see https://pkg.go.dev/plugin) that are used to add functionality -to Hilbish that cannot be written in Lua for any reason. - -Note that you don't ever need to use the load function that is here as -modules can be loaded with a `require` call like Lua C modules, and the -search paths can be changed with the `paths` property here. - -To make a valid native module, the Go plugin has to export a Loader function -with a signature like so: `func(*rt.Runtime) rt.Value`. - -`rt` in this case refers to the Runtime type at -https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime - -Hilbish uses this package as its Lua runtime. You will need to read -it to use it for a native plugin. - -Here is some code for an example plugin: -```go -package main - -import ( - rt "github.com/arnodel/golua/runtime" -) - -func Loader(rtm *rt.Runtime) rt.Value { - return rt.StringValue("hello world!") -} -``` - -This can be compiled with `go build -buildmode=plugin plugin.go`. -If you attempt to require and print the result (`print(require 'plugin')`), it will show "hello world!" - -## Functions -||| -|----|----| -|load(path)|Loads a module at the designated `path`.| - -## Static module fields -||| -|----|----| -|paths|A list of paths to search when loading native modules. This is in the style of Lua search paths and will be used when requiring native modules. Example: `?.so;?/?.so`| - -
-
-

-hilbish.module.load(path) - - - -

- -Loads a module at the designated `path`. -It will throw if any error occurs. - -#### Parameters -`string` **`path`** - - -
- diff --git a/docs/api/hilbish/hilbish.os.md b/docs/api/hilbish/hilbish.os.md deleted file mode 100644 index 13b56b05..00000000 --- a/docs/api/hilbish/hilbish.os.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Module hilbish.os -description: operating system info -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -Provides simple text information properties about the current operating system. -This mainly includes the name and version. - -## Static module fields -||| -|----|----| -|family|Family name of the current OS| -|name|Pretty name of the current OS| -|version|Version of the current OS| - diff --git a/docs/api/hilbish/hilbish.runner.md b/docs/api/hilbish/hilbish.runner.md deleted file mode 100644 index 4ba49993..00000000 --- a/docs/api/hilbish/hilbish.runner.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -title: Module hilbish.runner -description: interactive command runner customization -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction - The runner interface contains functions that allow the user to change -how Hilbish interprets interactive input. -Users can add and change the default runner for interactive input to any -language or script of their choosing. A good example is using it to -write command in Fennel. - -Runners are functions that evaluate user input. The default runners in -Hilbish can run shell script and Lua code. - -A runner is passed the input and has to return a table with these values. -All are not required, only the useful ones the runner needs to return. -(So if there isn't an error, just omit `err`.) - -- `exitCode` (number): Exit code of the command -- `input` (string): The text input of the user. This is used by Hilbish to append extra input, in case -more is requested. -- `err` (string): A string that represents an error from the runner. -This should only be set when, for example, there is a syntax error. -It can be set to a few special values for Hilbish to throw the right -hooks and have a better looking message. - - `\: not-found` will throw a `command.not-found` hook - based on what `\` is. - - `\: not-executable` will throw a `command.not-executable` hook. -- `continue` (boolean): Whether Hilbish should prompt the user for no input -- `newline` (boolean): Whether a newline should be added at the end of `input`. - -Here is a simple example of a fennel runner. It falls back to -shell script if fennel eval has an error. -```lua -local fennel = require 'fennel' - -hilbish.runnerMode(function(input) - local ok = pcall(fennel.eval, input) - if ok then - return { - input = input - } - end - - return hilbish.runner.sh(input) -end) -``` - -## Functions -||| -|----|----| -|lua(cmd)|Evaluates `cmd` as Lua input. This is the same as using `dofile`| -|sh()|nil| -|setMode(mode)|**NOTE: This function is deprecated and will be removed in 3.0**| -|setCurrent(name)|Sets Hilbish's runner mode by name.| -|set(name, runner)|*Sets* a runner by name. The difference between this function and| -|run(input, priv)|Runs `input` with the currently set Hilbish runner.| -|getCurrent()|Returns the current runner by name.| -|get(name)|Get a runner by name.| -|exec(cmd, runnerName)|Executes `cmd` with a runner.| -|add(name, runner)|Adds a runner to the table of available runners.| - -
-
-

-hilbish.runner.lua(cmd) - - - -

- -Evaluates `cmd` as Lua input. This is the same as using `dofile` -or `load`, but is appropriated for the runner interface. - -#### Parameters -`string` **`cmd`** - - -
- -
-
-

-hilbish.runner.add(name, runner) - - - -

- -Adds a runner to the table of available runners. -If runner is a table, it must have the run function in it. -#### Parameters -`name` **`string`** - Name of the runner - -`runner` **`function|table`** - - -
- -
-
-

-hilbish.runner.exec(cmd, runnerName) - - - -

- -Executes `cmd` with a runner. -If `runnerName` is not specified, it uses the default Hilbish runner. -#### Parameters -`cmd` **`string`** - - -`runnerName` **`string?`** - - -
- -
-
-

-hilbish.runner.get(name) - - - -

- -Get a runner by name. -#### Parameters -`name` **`string`** - Name of the runner to retrieve. - -
- -
-
-

-hilbish.runner.getCurrent() - - - -

- -Returns the current runner by name. -#### Parameters -This function has no parameters. -
- -
-
-

-hilbish.runner.run(input, priv) - - - -

- -Runs `input` with the currently set Hilbish runner. -This method is how Hilbish executes commands. -`priv` is an optional boolean used to state if the input should be saved to history. -#### Parameters -`input` **`string`** - - -`priv` **`bool`** - - -
- -
-
-

-hilbish.runner.set(name, runner) - - - -

- -*Sets* a runner by name. The difference between this function and -add, is set will *not* check if the named runner exists. -The runner table must have the run function in it. -#### Parameters -`name` **`string`** - - -`runner` **`table`** - - -
- -
-
-

-hilbish.runner.setCurrent(name) - - - -

- -Sets Hilbish's runner mode by name. -#### Parameters -`name` **`string`** - - -
- -
-
-

-hilbish.runner.setMode(mode) - - - -

- -**NOTE: This function is deprecated and will be removed in 3.0** -Use `hilbish.runner.setCurrent` instead. -This is the same as the `hilbish.runnerMode` function. -It takes a callback, which will be used to execute all interactive input. -Or a string which names the runner mode to use. -#### Parameters -`mode` **`string|function`** - - -
- -
-
-

-hilbish.runner.sh() - - - -

- - -#### Parameters -This function has no parameters. -
- diff --git a/docs/api/hilbish/hilbish.timers.md b/docs/api/hilbish/hilbish.timers.md deleted file mode 100644 index f218d2bc..00000000 --- a/docs/api/hilbish/hilbish.timers.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Module hilbish.timers -description: timeout and interval API -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction - -If you ever want to run a piece of code on a timed interval, or want to wait -a few seconds, you don't have to rely on timing tricks, as Hilbish has a -timer API to set intervals and timeouts. - -These are the simple functions `hilbish.interval` and `hilbish.timeout` (doc -accessible with `doc hilbish`, or `Module hilbish` on the Website). - -An example of usage: -```lua -local t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function() - print 'hello!' -end) - -t:start() -print(t.running) // true -``` - -## Functions -||| -|----|----| -|create(type, time, callback) -> @Timer|Creates a timer that runs based on the specified `time`.| -|get(id) -> @Timer|Retrieves a timer via its ID.| - -## Static module fields -||| -|----|----| -|INTERVAL|Constant for an interval timer type| -|TIMEOUT|Constant for a timeout timer type| - -
-
-

-hilbish.timers.create(type, time, callback) -> Timer - - - -

- -Creates a timer that runs based on the specified `time`. - -#### Parameters -`number` **`type`** -What kind of timer to create, can either be `hilbish.timers.INTERVAL` or `hilbish.timers.TIMEOUT` - -`number` **`time`** -The amount of time the function should run in milliseconds. - -`function` **`callback`** -The function to run for the timer. - -
- -
-
-

-hilbish.timers.get(id) -> Timer - - - -

- -Retrieves a timer via its ID. - -#### Parameters -`number` **`id`** - - -
- -## Types -
- -## Timer -The Job type describes a Hilbish timer. -## Object properties -||| -|----|----| -|type|What type of timer it is| -|running|If the timer is running| -|duration|The duration in milliseconds that the timer will run| - - -### Methods -#### start() -Starts a timer. - -#### stop() -Stops a timer. - diff --git a/docs/api/hilbish/hilbish.userDir.md b/docs/api/hilbish/hilbish.userDir.md deleted file mode 100644 index a2b73375..00000000 --- a/docs/api/hilbish/hilbish.userDir.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Module hilbish.userDir -description: user-related directories -layout: doc -menu: - docs: - parent: "API" ---- - -## Introduction -This interface just contains properties to know about certain user directories. -It is equivalent to XDG on Linux and gets the user's preferred directories -for configs and data. - -## Static module fields -||| -|----|----| -|config|The user's config directory| -|data|The user's directory for program data| - diff --git a/docs/api/snail.md b/docs/api/snail.md index f1833069..ea032606 100644 --- a/docs/api/snail.md +++ b/docs/api/snail.md @@ -9,42 +9,66 @@ menu: ## Introduction + The snail library houses Hilbish's Lua wrapper of its shell script interpreter. It's not very useful other than running shell scripts, which can be done with other Hilbish functions. ## Functions -||| -|----|----| -|new() -> @Snail|Creates a new Snail instance.| -
+``` =html +
+ + + + + + + +
new() -> @SnailCreates a new Snail instance.
+
+``` + +## Functions + +``` =html +
-

-snail.new() -> Snail +

+snail.new() -> @Snail

+``` + Creates a new Snail instance. #### Parameters + This function has no parameters. -
+ ## Types -
+ +``` =html +
+``` ## Snail + A Snail is a shell script interpreter instance. ### Methods + #### dir(path) + Changes the directory of the snail instance. The interpreter keeps its set directory even when the Hilbish process changes directory, so this should be called on the `hilbish.cd` hook. #### run(command, streams) + Runs a shell command. Works the same as `hilbish.run`, but only accepts a table of streams. diff --git a/docs/api/terminal.md b/docs/api/terminal.md index 1bd4cc10..496e451d 100644 --- a/docs/api/terminal.md +++ b/docs/api/terminal.md @@ -8,74 +8,112 @@ menu: --- ## Introduction + The terminal library is a simple and lower level library for certain terminal interactions. ## Functions -||| -|----|----| -|restoreState()|Restores the last saved state of the terminal| -|saveState()|Saves the current state of the terminal.| -|setRaw()|Puts the terminal into raw mode.| -|size()|Gets the dimensions of the terminal. Returns a table with `width` and `height`| -
+``` =html +
+ + + + + + + + + + + + + + + + + + + +
restoreState()Restores the last saved state of the terminal
saveState()Saves the current state of the terminal.
setRaw()Puts the terminal into raw mode.
size()Gets the dimensions of the terminal. Returns a table with `width` and `height`
+
+``` + +## Functions + +``` =html +
-

+

terminal.restoreState()

+``` + Restores the last saved state of the terminal #### Parameters -This function has no parameters. -
-
+This function has no parameters. + + +``` =html +
-

+

terminal.saveState()

+``` + Saves the current state of the terminal. #### Parameters -This function has no parameters. -
-
+This function has no parameters. + + +``` =html +
-

+

terminal.setRaw()

+``` + Puts the terminal into raw mode. #### Parameters -This function has no parameters. -
-
+This function has no parameters. + + +``` =html +
-

+

terminal.size()

+``` + Gets the dimensions of the terminal. Returns a table with `width` and `height` NOTE: The size refers to the amount of columns and rows of text that can fit in the terminal. #### Parameters -This function has no parameters. -
+ +This function has no parameters. + diff --git a/emmyLuaDocs/bait.lua b/emmyLuaDocs/bait.lua deleted file mode 100644 index c38eea1b..00000000 --- a/emmyLuaDocs/bait.lua +++ /dev/null @@ -1,28 +0,0 @@ ---- @meta - -local bait = {} - ---- Catches an event. This function can be used to act on events. ---- ---- -function bait.catch(name, cb) end - ---- Catches an event, but only once. This will remove the hook immediately after it runs for the first time. -function bait.catchOnce(name, cb) end - ---- Returns a table of functions that are hooked on an event with the corresponding `name`. -function bait.hooks(name) end - ---- Removes the `catcher` for the event with `name`. ---- For this to work, `catcher` has to be the same function used to catch ---- an event, like one saved to a variable. ---- ---- -function bait.release(name, catcher) end - ---- Throws a hook with `name` with the provided `args`. ---- ---- -function bait.throw(name, ...args) end - -return bait diff --git a/emmyLuaDocs/commander.lua b/emmyLuaDocs/commander.lua deleted file mode 100644 index bfa69e57..00000000 --- a/emmyLuaDocs/commander.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- @meta - -local commander = {} - ---- Removes the named command. Note that this will only remove Commander-registered commands. -function commander.deregister(name) end - ---- Adds a new command with the given `name`. When Hilbish has to run a command with a name, ---- it will run the function providing the arguments and sinks. ---- ---- -function commander.register(name, cb) end - ---- Returns all registered commanders. Returns a list of tables with the following keys: ---- - `exec`: The function used to run the commander. Commanders require args and sinks to be passed. -function commander.registry() end - -return commander diff --git a/emmyLuaDocs/fs.lua b/emmyLuaDocs/fs.lua deleted file mode 100644 index ef80eba9..00000000 --- a/emmyLuaDocs/fs.lua +++ /dev/null @@ -1,54 +0,0 @@ ---- @meta - -local fs = {} - ---- Returns an absolute version of the `path`. ---- This can be used to resolve short paths like `..` to `/home/user`. -function fs.abs(path) end - ---- Returns the "basename," or the last part of the provided `path`. If path is empty, ---- `.` will be returned. -function fs.basename(path) end - ---- Changes Hilbish's directory to `dir`. -function fs.cd(dir) end - ---- Returns the directory part of `path`. If a file path like ---- `~/Documents/doc.txt` then this function will return `~/Documents`. -function fs.dir(path) end - ---- Match all files based on the provided `pattern`. ---- For the syntax' refer to Go's filepath.Match function: https://pkg.go.dev/path/filepath#Match ---- ---- -function fs.glob(pattern) end - ---- Takes any list of paths and joins them based on the operating system's path separator. ---- ---- -function fs.join(...path) end - ---- Creates a new directory with the provided `name`. ---- With `recursive`, mkdir will create parent directories. ---- ---- -function fs.mkdir(name, recursive) end - ---- Returns a pair of connected files, also known as a pipe. ---- The type returned is a Lua file, same as returned from `io` functions. -function fs.fpipe() end - ---- Returns a list of all files and directories in the provided path. -function fs.readdir(path) end - ---- Returns the information about a given `path`. ---- The returned table contains the following values: ---- name (string) - Name of the path ---- size (number) - Size of the path in bytes ---- mode (string) - Unix permission mode in an octal format string (with leading 0) ---- isDir (boolean) - If the path is a directory ---- ---- -function fs.stat(path) end - -return fs diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua deleted file mode 100644 index 4e5f4f1d..00000000 --- a/emmyLuaDocs/hilbish.lua +++ /dev/null @@ -1,240 +0,0 @@ ---- @meta - -local hilbish = {} - ---- Sets/toggles the option of automatically flushing output. ---- A call with no argument will toggle the value. ---- @param auto boolean|nil -function hilbish:autoFlush(auto) end - ---- Flush writes all buffered input to the sink. -function hilbish:flush() end - ---- Reads a liine of input from the sink. ---- @returns string -function hilbish:read() end - ---- Reads all input from the sink. ---- @returns string -function hilbish:readAll() end - ---- Writes data to a sink. -function hilbish:write(str) end - ---- Writes data to a sink with a newline at the end. -function hilbish:writeln(str) end - ---- This is an alias (ha) for the [hilbish.alias](../#alias) function. ---- @param alias string ---- @param cmd string -function hilbish.aliases.add(alias, cmd) end - ---- Deletes characters in the line by the given amount. -function hilbish.editor.deleteByAmount(amount) end - ---- Returns the current input line. -function hilbish.editor.getLine() end - ---- Returns the text that is at the register. -function hilbish.editor.getVimRegister(register) end - ---- Inserts text into the Hilbish command line. -function hilbish.editor.insert(text) end - ---- Reads a keystroke from the user. This is in a format of something like Ctrl-L. -function hilbish.editor.getChar() end - ---- Sets the vim register at `register` to hold the passed text. -function hilbish.editor.setVimRegister(register, text) end - ---- Return binaries/executables based on the provided parameters. ---- This function is meant to be used as a helper in a command completion handler. ---- ---- -function hilbish.completion.bins(query, ctx, fields) end - ---- Calls a completer function. This is mainly used to call a command completer, which will have a `name` ---- in the form of `command.name`, example: `command.git`. ---- You can check the Completions doc or `doc completions` for info on the `completionGroups` return value. -function hilbish.completion.call(name, query, ctx, fields) end - ---- Returns file matches based on the provided parameters. ---- This function is meant to be used as a helper in a command completion handler. -function hilbish.completion.files(query, ctx, fields) end - ---- This function contains the general completion handler for Hilbish. This function handles ---- completion of everything, which includes calling other command handlers, binaries, and files. ---- This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function. ---- ---- -function hilbish.completion.handler(line, pos) end - ---- Sets an alias, with a name of `cmd` to another command. ---- ---- -function hilbish.alias(cmd, orig) end - ---- Appends the provided dir to the command path (`$PATH`) ---- ---- -function hilbish.appendPath(dir) end - ---- Registers a completion handler for the specified scope. ---- A `scope` is expected to be `command.`, ---- replacing with the name of the command (for example `command.git`). ---- The documentation for completions, under Features/Completions or `doc completions` ---- provides more details. ---- ---- -function hilbish.complete(scope, cb) end - ---- Returns the current directory of the shell. -function hilbish.cwd() end - ---- Replaces the currently running Hilbish instance with the supplied command. ---- This can be used to do an in-place restart. -function hilbish.exec(cmd) end - ---- Puts `fn` in a Goroutine. ---- This can be used to run any function in another thread at the same time as other Lua code. ---- **NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.** ---- **This is a limitation of the Lua runtime.** -function hilbish.goro(fn) end - ---- Line highlighter handler. ---- This is mainly for syntax highlighting, but in reality could set the input ---- of the prompt to *display* anything. The callback is passed the current line ---- and is expected to return a line that will be used as the input display. ---- Note that to set a highlighter, one has to override this function. ---- -function hilbish.highlighter(line) end - ---- The command line hint handler. It gets called on every key insert to ---- determine what text to use as an inline hint. It is passed the current ---- line and cursor position. It is expected to return a string which is used ---- as the text for the hint. This is by default a shim. To set hints, ---- override this function with your custom handler. ---- ---- -function hilbish.hinter(line, pos) end - ---- Sets the input mode for Hilbish's line reader. ---- `emacs` is the default. Setting it to `vim` changes behavior of input to be ---- Vim-like with modes and Vim keybinds. -function hilbish.inputMode(mode) end - ---- Runs the `cb` function every specified amount of `time`. ---- This creates a timer that ticking immediately. -function hilbish.interval(cb, time) end - ---- Changes the text prompt when Hilbish asks for more input. ---- This will show up when text is incomplete, like a missing quote ---- ---- -function hilbish.multiprompt(str) end - ---- Prepends `dir` to $PATH. -function hilbish.prependPath(dir) end - ---- Changes the shell prompt to the provided string. ---- There are a few verbs that can be used in the prompt text. ---- These will be formatted and replaced with the appropriate values. ---- `%d` - Current working directory ---- `%u` - Name of current user ---- `%h` - Hostname of device ---- -function hilbish.prompt(str, typ) end - ---- Read input from the user, using Hilbish's line editor/input reader. ---- This is a separate instance from the one Hilbish actually uses. ---- Returns `input`, will be nil if Ctrl-D is pressed, or an error occurs. -function hilbish.read(prompt) end - ---- Executed the `cb` function after a period of `time`. ---- This creates a Timer that starts ticking immediately. -function hilbish.timeout(cb, time) end - ---- Checks if `name` is a valid command. ---- Will return the path of the binary, or a basename if it's a commander. -function hilbish.which(name) end - ---- Puts a job in the background. This acts the same as initially running a job. -function hilbish.jobs:background() end - ---- Puts a job in the foreground. This will cause it to run like it was ---- executed normally and wait for it to complete. -function hilbish.jobs:foreground() end - ---- Evaluates `cmd` as Lua input. This is the same as using `dofile` ---- or `load`, but is appropriated for the runner interface. -function hilbish.runner.lua(cmd) end - ---- Starts running the job. -function hilbish.jobs:start() end - ---- Stops the job from running. -function hilbish.jobs:stop() end - ---- Loads a module at the designated `path`. ---- It will throw if any error occurs. -function hilbish.module.load(path) end - ---- Starts a timer. -function hilbish.timers:start() end - ---- Stops a timer. -function hilbish.timers:stop() end - ---- Removes an alias. -function hilbish.aliases.delete(name) end - ---- Get a table of all aliases, with string keys as the alias and the value as the command. ---- ---- -function hilbish.aliases.list() end - ---- Resolves an alias to its original command. Will thrown an error if the alias doesn't exist. -function hilbish.aliases.resolve(alias) end - ---- Creates a new job. This function does not run the job. This function is intended to be ---- used by runners, but can also be used to create jobs via Lua. Commanders cannot be ran as jobs. ---- ---- -function hilbish.jobs.add(cmdstr, args, execPath) end - ---- Returns a table of all job objects. -function hilbish.jobs.all() end - ---- Disowns a job. This simply deletes it from the list of jobs without stopping it. -function hilbish.jobs.disown(id) end - ---- Get a job object via its ID. ---- @param id number ---- @returns Job -function hilbish.jobs.get(id) end - ---- Returns the last added job to the table. -function hilbish.jobs.last() end - ---- Adds a command to the history. -function hilbish.history.add(cmd) end - ---- Retrieves all history as a table. -function hilbish.history.all() end - ---- Deletes all commands from the history. -function hilbish.history.clear() end - ---- Retrieves a command from the history based on the `index`. -function hilbish.history.get(index) end - ---- Returns the amount of commands in the history. -function hilbish.history.size() end - ---- Creates a timer that runs based on the specified `time`. -function hilbish.timers.create(type, time, callback) end - ---- Retrieves a timer via its ID. -function hilbish.timers.get(id) end - -return hilbish diff --git a/emmyLuaDocs/snail.lua b/emmyLuaDocs/snail.lua deleted file mode 100644 index 94c84dfb..00000000 --- a/emmyLuaDocs/snail.lua +++ /dev/null @@ -1,16 +0,0 @@ ---- @meta - -local snail = {} - ---- Changes the directory of the snail instance. ---- The interpreter keeps its set directory even when the Hilbish process changes ---- directory, so this should be called on the `hilbish.cd` hook. -function snail:dir(path) end - ---- Creates a new Snail instance. -function snail.new() end - ---- Runs a shell command. Works the same as `hilbish.run`, but only accepts a table of streams. -function snail:run(command, streams) end - -return snail diff --git a/emmyLuaDocs/terminal.lua b/emmyLuaDocs/terminal.lua deleted file mode 100644 index ed0b9efd..00000000 --- a/emmyLuaDocs/terminal.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- @meta - -local terminal = {} - ---- Restores the last saved state of the terminal -function terminal.restoreState() end - ---- Saves the current state of the terminal. -function terminal.saveState() end - ---- Puts the terminal into raw mode. -function terminal.setRaw() end - ---- Gets the dimensions of the terminal. Returns a table with `width` and `height` ---- NOTE: The size refers to the amount of columns and rows of text that can fit in the terminal. -function terminal.size() end - -return terminal diff --git a/emmyLuaDocs/util.lua b/emmyLuaDocs/util.lua deleted file mode 100644 index 9f8d634f..00000000 --- a/emmyLuaDocs/util.lua +++ /dev/null @@ -1,83 +0,0 @@ ---- @meta - -local util = {} - ---- -function util.AbbrevHome changes the user's home directory in the path string to ~ (tilde) end - ---- -function util. end - ---- -function util.DoFile runs the contents of the file in the Lua runtime. end - ---- -function util.DoString runs the code string in the Lua runtime. end - ---- directory. -function util.ExpandHome expands ~ (tilde) in the path, changing it to the user home end - ---- -function util. end - ---- -function util.ForEach loops through a Lua table. end - ---- -function util. end - ---- a string and a closure. -function util.HandleStrCallback handles function parameters for Go functions which take end - ---- -function util. end - ---- -function util. end - ---- -function util.SetExports puts the Lua function exports in the table. end - ---- It is accessible via the __docProp metatable. It is a table of the names of the fields. -function util.SetField sets a field in a table, adding docs for it. end - ---- is one which has a metatable proxy to ensure no overrides happen to it. ---- It sets the field in the table and sets the __docProp metatable on the ---- user facing table. -function util.SetFieldProtected sets a field in a protected table. A protected table end - ---- Sets/toggles the option of automatically flushing output. ---- A call with no argument will toggle the value. ---- @param auto boolean|nil -function util:autoFlush(auto) end - ---- Flush writes all buffered input to the sink. -function util:flush() end - ---- -function util. end - ---- Reads a liine of input from the sink. ---- @returns string -function util:read() end - ---- Reads all input from the sink. ---- @returns string -function util:readAll() end - ---- Writes data to a sink. -function util:write(str) end - ---- Writes data to a sink with a newline at the end. -function util:writeln(str) end - ---- -function util. end - ---- -function util. end - ---- -function util. end - -return util diff --git a/website/content/install.md b/website/content/install.md index 392ded04..1460f0c9 100644 --- a/website/content/install.md +++ b/website/content/install.md @@ -5,56 +5,45 @@ layout: page --- ## Official Binaries + The best way to get Hilbish is to get a build directly from GitHub. -At any time, there are 2 versions of Hilbish recommended for download: + +At any time, there are 2 versions of Hilbish available to install: the latest stable release, and development builds from the master branch. You can download both at any time, but note that the development builds may have breaking changes. -For the latest **stable release**, check here: https://github.com/Rosettea/Hilbish/releases/latest -For a **development build**: https://nightly.link/Rosettea/Hilbish/workflows/build/master +For the latest *stable release*, check here: https://github.com/Rosettea/Hilbish/releases/latest + +For a *development build*: https://nightly.link/Rosettea/Hilbish/workflows/build/master ## Compiling + To read the steps for compiling Hilbish, head over to the [GitHub repository.](https://github.com/Rosettea/Hilbish#build) ## Package Repositories + Methods of installing Hilbish for your Linux distro. ### Fedora (COPR) + An official COPR is offered to install Hilbish easily on Fedora. -Enable the repo: -``` -sudo dnf copr enable sammyette/Hilbish -``` +Enable the repo: `dnf copr enable sammyette/Hilbish` -And install Hilbish: -``` -sudo dnf install hilbish -``` +And install Hilbish: `dnf install hilbish` -Or for the latest development build from master: -``` -sudo dnf install hilbish-git -``` +Or for the latest development build from master: `dnf install hilbish-git` ### Arch Linux (AUR) + Hilbish is on the AUR. Setup an AUR helper, and install. -Example with yay: -``` -yay -S hilbish -``` +Example with yay: `yay -S hilbish` -Or, from master branch: -``` -yay -S hilbish-git -``` +Or, from master branch: `yay -S hilbish-git` ### Alpine Linux + Hilbish is currentlty in the testing/edge repository for Alpine. -Follow the steps [here](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository) -(Using testing repositories) and install: -``` -apk add hilbish -``` +Follow the steps [here](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository) (using testing repositories) and install: `apk add hilbish` diff --git a/website/package-lock.json b/website/package-lock.json index 452a8255..a826df80 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -6,8 +6,22 @@ "": { "dependencies": { "@djot/djot": "^0.3.2", - "@tailwindcss/cli": "^4.1.4", - "tailwindcss": "^4.1.4" + "@tailwindcss/cli": "^4.1.10", + "npm-watch": "^0.13.0", + "tailwindcss": "^4.1.10" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" } }, "node_modules/@djot/djot": { @@ -22,6 +36,66 @@ "node": ">=17.0.0" } }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@parcel/watcher": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", @@ -318,62 +392,70 @@ } }, "node_modules/@tailwindcss/cli": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/cli/-/cli-4.1.4.tgz", - "integrity": "sha512-gP05Qihh+cZ2FqD5fa0WJXx3KEk2YWUYv/RBKAyiOg0V4vYVDr/xlLc0sacpnVEXM45BVUR9U2hsESufYs6YTA==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/cli/-/cli-4.1.10.tgz", + "integrity": "sha512-TuO7IOUpTG1JeqtMQbQXjR4RIhfZ43mor/vpCp3S5X9h0WxUom5NYgxfNO0PiFoLMJ6/eYCelC7KGvUOmqqK6A==", "license": "MIT", "dependencies": { "@parcel/watcher": "^2.5.1", - "@tailwindcss/node": "4.1.4", - "@tailwindcss/oxide": "4.1.4", + "@tailwindcss/node": "4.1.10", + "@tailwindcss/oxide": "4.1.10", "enhanced-resolve": "^5.18.1", "mri": "^1.2.0", "picocolors": "^1.1.1", - "tailwindcss": "4.1.4" + "tailwindcss": "4.1.10" }, "bin": { "tailwindcss": "dist/index.mjs" } }, "node_modules/@tailwindcss/node": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.4.tgz", - "integrity": "sha512-MT5118zaiO6x6hNA04OWInuAiP1YISXql8Z+/Y8iisV5nuhM8VXlyhRuqc2PEviPszcXI66W44bCIk500Oolhw==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.10.tgz", + "integrity": "sha512-2ACf1znY5fpRBwRhMgj9ZXvb2XZW8qs+oTfotJ2C5xR0/WNL7UHZ7zXl6s+rUqedL1mNi+0O+WQr5awGowS3PQ==", "license": "MIT", "dependencies": { + "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", - "lightningcss": "1.29.2", - "tailwindcss": "4.1.4" + "lightningcss": "1.30.1", + "magic-string": "^0.30.17", + "source-map-js": "^1.2.1", + "tailwindcss": "4.1.10" } }, "node_modules/@tailwindcss/oxide": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.4.tgz", - "integrity": "sha512-p5wOpXyOJx7mKh5MXh5oKk+kqcz8T+bA3z/5VWWeQwFrmuBItGwz8Y2CHk/sJ+dNb9B0nYFfn0rj/cKHZyjahQ==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.10.tgz", + "integrity": "sha512-v0C43s7Pjw+B9w21htrQwuFObSkio2aV/qPx/mhrRldbqxbWJK6KizM+q7BF1/1CmuLqZqX3CeYF7s7P9fbA8Q==", + "hasInstallScript": true, "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.4", + "tar": "^7.4.3" + }, "engines": { "node": ">= 10" }, "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.1.4", - "@tailwindcss/oxide-darwin-arm64": "4.1.4", - "@tailwindcss/oxide-darwin-x64": "4.1.4", - "@tailwindcss/oxide-freebsd-x64": "4.1.4", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.4", - "@tailwindcss/oxide-linux-arm64-gnu": "4.1.4", - "@tailwindcss/oxide-linux-arm64-musl": "4.1.4", - "@tailwindcss/oxide-linux-x64-gnu": "4.1.4", - "@tailwindcss/oxide-linux-x64-musl": "4.1.4", - "@tailwindcss/oxide-wasm32-wasi": "4.1.4", - "@tailwindcss/oxide-win32-arm64-msvc": "4.1.4", - "@tailwindcss/oxide-win32-x64-msvc": "4.1.4" + "@tailwindcss/oxide-android-arm64": "4.1.10", + "@tailwindcss/oxide-darwin-arm64": "4.1.10", + "@tailwindcss/oxide-darwin-x64": "4.1.10", + "@tailwindcss/oxide-freebsd-x64": "4.1.10", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.10", + "@tailwindcss/oxide-linux-arm64-gnu": "4.1.10", + "@tailwindcss/oxide-linux-arm64-musl": "4.1.10", + "@tailwindcss/oxide-linux-x64-gnu": "4.1.10", + "@tailwindcss/oxide-linux-x64-musl": "4.1.10", + "@tailwindcss/oxide-wasm32-wasi": "4.1.10", + "@tailwindcss/oxide-win32-arm64-msvc": "4.1.10", + "@tailwindcss/oxide-win32-x64-msvc": "4.1.10" } }, "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.4.tgz", - "integrity": "sha512-xMMAe/SaCN/vHfQYui3fqaBDEXMu22BVwQ33veLc8ep+DNy7CWN52L+TTG9y1K397w9nkzv+Mw+mZWISiqhmlA==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.10.tgz", + "integrity": "sha512-VGLazCoRQ7rtsCzThaI1UyDu/XRYVyH4/EWiaSX6tFglE+xZB5cvtC5Omt0OQ+FfiIVP98su16jDVHDEIuH4iQ==", "cpu": [ "arm64" ], @@ -387,9 +469,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.4.tgz", - "integrity": "sha512-JGRj0SYFuDuAGilWFBlshcexev2hOKfNkoX+0QTksKYq2zgF9VY/vVMq9m8IObYnLna0Xlg+ytCi2FN2rOL0Sg==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.10.tgz", + "integrity": "sha512-ZIFqvR1irX2yNjWJzKCqTCcHZbgkSkSkZKbRM3BPzhDL/18idA8uWCoopYA2CSDdSGFlDAxYdU2yBHwAwx8euQ==", "cpu": [ "arm64" ], @@ -403,9 +485,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.4.tgz", - "integrity": "sha512-sdDeLNvs3cYeWsEJ4H1DvjOzaGios4QbBTNLVLVs0XQ0V95bffT3+scptzYGPMjm7xv4+qMhCDrkHwhnUySEzA==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.10.tgz", + "integrity": "sha512-eCA4zbIhWUFDXoamNztmS0MjXHSEJYlvATzWnRiTqJkcUteSjO94PoRHJy1Xbwp9bptjeIxxBHh+zBWFhttbrQ==", "cpu": [ "x64" ], @@ -419,9 +501,9 @@ } }, "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.4.tgz", - "integrity": "sha512-VHxAqxqdghM83HslPhRsNhHo91McsxRJaEnShJOMu8mHmEj9Ig7ToHJtDukkuLWLzLboh2XSjq/0zO6wgvykNA==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.10.tgz", + "integrity": "sha512-8/392Xu12R0cc93DpiJvNpJ4wYVSiciUlkiOHOSOQNH3adq9Gi/dtySK7dVQjXIOzlpSHjeCL89RUUI8/GTI6g==", "cpu": [ "x64" ], @@ -435,9 +517,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.4.tgz", - "integrity": "sha512-OTU/m/eV4gQKxy9r5acuesqaymyeSCnsx1cFto/I1WhPmi5HDxX1nkzb8KYBiwkHIGg7CTfo/AcGzoXAJBxLfg==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.10.tgz", + "integrity": "sha512-t9rhmLT6EqeuPT+MXhWhlRYIMSfh5LZ6kBrC4FS6/+M1yXwfCtp24UumgCWOAJVyjQwG+lYva6wWZxrfvB+NhQ==", "cpu": [ "arm" ], @@ -451,9 +533,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.4.tgz", - "integrity": "sha512-hKlLNvbmUC6z5g/J4H+Zx7f7w15whSVImokLPmP6ff1QqTVE+TxUM9PGuNsjHvkvlHUtGTdDnOvGNSEUiXI1Ww==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.10.tgz", + "integrity": "sha512-3oWrlNlxLRxXejQ8zImzrVLuZ/9Z2SeKoLhtCu0hpo38hTO2iL86eFOu4sVR8cZc6n3z7eRXXqtHJECa6mFOvA==", "cpu": [ "arm64" ], @@ -467,9 +549,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.4.tgz", - "integrity": "sha512-X3As2xhtgPTY/m5edUtddmZ8rCruvBvtxYLMw9OsZdH01L2gS2icsHRwxdU0dMItNfVmrBezueXZCHxVeeb7Aw==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.10.tgz", + "integrity": "sha512-saScU0cmWvg/Ez4gUmQWr9pvY9Kssxt+Xenfx1LG7LmqjcrvBnw4r9VjkFcqmbBb7GCBwYNcZi9X3/oMda9sqQ==", "cpu": [ "arm64" ], @@ -483,9 +565,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.4.tgz", - "integrity": "sha512-2VG4DqhGaDSmYIu6C4ua2vSLXnJsb/C9liej7TuSO04NK+JJJgJucDUgmX6sn7Gw3Cs5ZJ9ZLrnI0QRDOjLfNQ==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.10.tgz", + "integrity": "sha512-/G3ao/ybV9YEEgAXeEg28dyH6gs1QG8tvdN9c2MNZdUXYBaIY/Gx0N6RlJzfLy/7Nkdok4kaxKPHKJUlAaoTdA==", "cpu": [ "x64" ], @@ -499,9 +581,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.4.tgz", - "integrity": "sha512-v+mxVgH2kmur/X5Mdrz9m7TsoVjbdYQT0b4Z+dr+I4RvreCNXyCFELZL/DO0M1RsidZTrm6O1eMnV6zlgEzTMQ==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.10.tgz", + "integrity": "sha512-LNr7X8fTiKGRtQGOerSayc2pWJp/9ptRYAa4G+U+cjw9kJZvkopav1AQc5HHD+U364f71tZv6XamaHKgrIoVzA==", "cpu": [ "x64" ], @@ -515,9 +597,9 @@ } }, "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.4.tgz", - "integrity": "sha512-2TLe9ir+9esCf6Wm+lLWTMbgklIjiF0pbmDnwmhR9MksVOq+e8aP3TSsXySnBDDvTTVd/vKu1aNttEGj3P6l8Q==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.10.tgz", + "integrity": "sha512-d6ekQpopFQJAcIK2i7ZzWOYGZ+A6NzzvQ3ozBvWFdeyqfOZdYHU66g5yr+/HC4ipP1ZgWsqa80+ISNILk+ae/Q==", "bundleDependencies": [ "@napi-rs/wasm-runtime", "@emnapi/core", @@ -532,10 +614,10 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.4.0", - "@emnapi/runtime": "^1.4.0", - "@emnapi/wasi-threads": "^1.0.1", - "@napi-rs/wasm-runtime": "^0.2.8", + "@emnapi/core": "^1.4.3", + "@emnapi/runtime": "^1.4.3", + "@emnapi/wasi-threads": "^1.0.2", + "@napi-rs/wasm-runtime": "^0.2.10", "@tybys/wasm-util": "^0.9.0", "tslib": "^2.8.0" }, @@ -544,9 +626,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.4.tgz", - "integrity": "sha512-VlnhfilPlO0ltxW9/BgfLI5547PYzqBMPIzRrk4W7uupgCt8z6Trw/tAj6QUtF2om+1MH281Pg+HHUJoLesmng==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.10.tgz", + "integrity": "sha512-i1Iwg9gRbwNVOCYmnigWCCgow8nDWSFmeTUU5nbNx3rqbe4p0kRbEqLwLJbYZKmSSp23g4N6rCDmm7OuPBXhDA==", "cpu": [ "arm64" ], @@ -560,9 +642,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.4.tgz", - "integrity": "sha512-+7S63t5zhYjslUGb8NcgLpFXD+Kq1F/zt5Xv5qTv7HaFTG/DHyHD9GA6ieNAxhgyA4IcKa/zy7Xx4Oad2/wuhw==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.10.tgz", + "integrity": "sha512-sGiJTjcBSfGq2DVRtaSljq5ZgZS2SDHSIfhOylkBvHVjwOsodBhnb3HdmiKkVuUGKD0I7G63abMOVaskj1KpOA==", "cpu": [ "x64" ], @@ -575,6 +657,56 @@ "node": ">= 10" } }, + "node_modules/@tailwindcss/oxide/node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", @@ -587,6 +719,62 @@ "node": ">=8" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -624,12 +812,71 @@ "node": ">=8" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "license": "ISC" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -670,9 +917,9 @@ } }, "node_modules/lightningcss": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.29.2.tgz", - "integrity": "sha512-6b6gd/RUXKaw5keVdSEtqFVdzWnU5jMxTUjA2bVcMNPLwSQ08Sv/UodBVtETLCn7k4S1Ibxwh7k68IwLZPgKaA==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.1.tgz", + "integrity": "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==", "license": "MPL-2.0", "dependencies": { "detect-libc": "^2.0.3" @@ -685,22 +932,22 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-darwin-arm64": "1.29.2", - "lightningcss-darwin-x64": "1.29.2", - "lightningcss-freebsd-x64": "1.29.2", - "lightningcss-linux-arm-gnueabihf": "1.29.2", - "lightningcss-linux-arm64-gnu": "1.29.2", - "lightningcss-linux-arm64-musl": "1.29.2", - "lightningcss-linux-x64-gnu": "1.29.2", - "lightningcss-linux-x64-musl": "1.29.2", - "lightningcss-win32-arm64-msvc": "1.29.2", - "lightningcss-win32-x64-msvc": "1.29.2" + "lightningcss-darwin-arm64": "1.30.1", + "lightningcss-darwin-x64": "1.30.1", + "lightningcss-freebsd-x64": "1.30.1", + "lightningcss-linux-arm-gnueabihf": "1.30.1", + "lightningcss-linux-arm64-gnu": "1.30.1", + "lightningcss-linux-arm64-musl": "1.30.1", + "lightningcss-linux-x64-gnu": "1.30.1", + "lightningcss-linux-x64-musl": "1.30.1", + "lightningcss-win32-arm64-msvc": "1.30.1", + "lightningcss-win32-x64-msvc": "1.30.1" } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.29.2.tgz", - "integrity": "sha512-cK/eMabSViKn/PG8U/a7aCorpeKLMlK0bQeNHmdb7qUnBkNPnL+oV5DjJUo0kqWsJUapZsM4jCfYItbqBDvlcA==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.1.tgz", + "integrity": "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ==", "cpu": [ "arm64" ], @@ -718,9 +965,9 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.29.2.tgz", - "integrity": "sha512-j5qYxamyQw4kDXX5hnnCKMf3mLlHvG44f24Qyi2965/Ycz829MYqjrVg2H8BidybHBp9kom4D7DR5VqCKDXS0w==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.1.tgz", + "integrity": "sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA==", "cpu": [ "x64" ], @@ -738,9 +985,9 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.29.2.tgz", - "integrity": "sha512-wDk7M2tM78Ii8ek9YjnY8MjV5f5JN2qNVO+/0BAGZRvXKtQrBC4/cn4ssQIpKIPP44YXw6gFdpUF+Ps+RGsCwg==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.1.tgz", + "integrity": "sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig==", "cpu": [ "x64" ], @@ -758,9 +1005,9 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.29.2.tgz", - "integrity": "sha512-IRUrOrAF2Z+KExdExe3Rz7NSTuuJ2HvCGlMKoquK5pjvo2JY4Rybr+NrKnq0U0hZnx5AnGsuFHjGnNT14w26sg==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.1.tgz", + "integrity": "sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q==", "cpu": [ "arm" ], @@ -778,9 +1025,9 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.29.2.tgz", - "integrity": "sha512-KKCpOlmhdjvUTX/mBuaKemp0oeDIBBLFiU5Fnqxh1/DZ4JPZi4evEH7TKoSBFOSOV3J7iEmmBaw/8dpiUvRKlQ==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.1.tgz", + "integrity": "sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw==", "cpu": [ "arm64" ], @@ -798,9 +1045,9 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.29.2.tgz", - "integrity": "sha512-Q64eM1bPlOOUgxFmoPUefqzY1yV3ctFPE6d/Vt7WzLW4rKTv7MyYNky+FWxRpLkNASTnKQUaiMJ87zNODIrrKQ==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.1.tgz", + "integrity": "sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==", "cpu": [ "arm64" ], @@ -818,9 +1065,9 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.29.2.tgz", - "integrity": "sha512-0v6idDCPG6epLXtBH/RPkHvYx74CVziHo6TMYga8O2EiQApnUPZsbR9nFNrg2cgBzk1AYqEd95TlrsL7nYABQg==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.1.tgz", + "integrity": "sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==", "cpu": [ "x64" ], @@ -838,9 +1085,9 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.29.2.tgz", - "integrity": "sha512-rMpz2yawkgGT8RULc5S4WiZopVMOFWjiItBT7aSfDX4NQav6M44rhn5hjtkKzB+wMTRlLLqxkeYEtQ3dd9696w==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.1.tgz", + "integrity": "sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==", "cpu": [ "x64" ], @@ -858,9 +1105,9 @@ } }, "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.29.2.tgz", - "integrity": "sha512-nL7zRW6evGQqYVu/bKGK+zShyz8OVzsCotFgc7judbt6wnB2KbiKKJwBE4SGoDBQ1O94RjW4asrCjQL4i8Fhbw==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.1.tgz", + "integrity": "sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==", "cpu": [ "arm64" ], @@ -878,9 +1125,9 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.29.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.29.2.tgz", - "integrity": "sha512-EdIUW3B2vLuHmv7urfzMI/h2fmlnOQBk1xlsDxkN1tCWKjNFjfLhGxYk8C8mzpSfr+A6jFFIi8fU6LbQGsRWjA==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.1.tgz", + "integrity": "sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg==", "cpu": [ "x64" ], @@ -906,6 +1153,15 @@ "node": ">=8" } }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -919,6 +1175,54 @@ "node": ">=8.6" } }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minizlib": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz", + "integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==", + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -928,12 +1232,68 @@ "node": ">=4" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, "node_modules/node-addon-api": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "license": "MIT" }, + "node_modules/nodemon": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", + "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==", + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-watch": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/npm-watch/-/npm-watch-0.13.0.tgz", + "integrity": "sha512-MYcgocqCzYA44feZhFoYj69FfSaO0EeRE1gcRcmPaXIpNhUMAhNJ1pwic2C4Hn0OPOQmZKSl90CPgmwvOsVhTg==", + "license": "MIT", + "dependencies": { + "nodemon": "^3.0.1", + "through2": "^4.0.2" + }, + "bin": { + "npm-watch": "cli.js" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -952,21 +1312,153 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/tailwindcss": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.4.tgz", - "integrity": "sha512-1ZIUqtPITFbv/DxRmDr5/agPqJwF69d24m9qmM1939TJehgY539CtzeZRjbLt5G6fSy/7YqqYsfvoTEw9xUI2A==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.10.tgz", + "integrity": "sha512-P3nr6WkvKV/ONsTzj6Gb57sWPMX29EPNPopo7+FcpkQaNsrNpZ1pv8QmrYI2RqEKD7mlGqLnGovlcYnBK0IqUA==", "license": "MIT" }, "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", + "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/tar": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", + "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", + "license": "ISC", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "license": "MIT", + "dependencies": { + "readable-stream": "3" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -978,6 +1470,36 @@ "engines": { "node": ">=8.0" } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "license": "MIT" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } } } } diff --git a/website/package.json b/website/package.json index e4c0a702..63f1c781 100644 --- a/website/package.json +++ b/website/package.json @@ -1,7 +1,17 @@ { "dependencies": { "@djot/djot": "^0.3.2", - "@tailwindcss/cli": "^4.1.4", - "tailwindcss": "^4.1.4" + "@tailwindcss/cli": "^4.1.10", + "npm-watch": "^0.13.0", + "tailwindcss": "^4.1.10" + }, + "watch": { + "website": "src/*.gleam" + }, + "scripts": { + "website": "npm run gleam-build && npm run tailwind", + "gleam-build": "gleam run -m website", + "tailwind": "npx @tailwindcss/cli -o public/tailwind.css", + "watch": "npm-watch" } } diff --git a/website/src/conf.gleam b/website/src/conf.gleam index 53251ca5..d384af7a 100644 --- a/website/src/conf.gleam +++ b/website/src/conf.gleam @@ -1,5 +1,5 @@ -pub const base_url = "" +pub const base_url = "http://localhost:9080" pub fn base_url_join(cont: String) -> String { - base_url <> "/" <> cont + base_url <> "/" <> cont } diff --git a/website/src/pages/doc.gleam b/website/src/pages/doc.gleam index 2486cfaf..a5421312 100644 --- a/website/src/pages/doc.gleam +++ b/website/src/pages/doc.gleam @@ -11,115 +11,137 @@ import jot import post pub fn page(p: post.Post, doc_pages_list) -> element.Element(a) { - html.div([attribute.class("flex flex-col")], [ - html.div([attribute.class("h-10 flex py-2 px-4 border-b border-b-zinc-300 w-full gap-2 backdrop-blur-sm bg-zinc-300/50 dark:bg-zinc-800/50 z-50")], [ - html.label([attribute.for("sidebar-toggle"), attribute.class("cursor-pointer")], [ - element.unsafe_raw_html("", "tag", [], ""), - ]), - html.span([], [element.text(p.title)]) - ]), - html.div([attribute.class("grid")], [ - html.input([attribute.type_("checkbox"), attribute.id("sidebar-toggle"), attribute.class("peer hidden")]), - html.div([attribute.class("border-r border-r-zinc-300 col-start-1 row-start-1 sticky top-22 sm:top-12 h-full sm:h-svh bg-neutral-200 dark:bg-neutral-900 basis-3/5 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 z-30")], [ - html.div([attribute.class("p-4 -mb-4 overflow-y-auto h-full")], [ - html.h2([attribute.class("text-xl font-semibold mb-4")], [element.text("Sidebar")]), - html.ul([], list.map(doc_pages_list, fn(post: #(String, post.Post)) { - html.li([attribute.class("mb-2")], [element.text(post.1.title)]) - })) - ]) - ]), - html.main([attribute.class("col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30 px-4 pt-2")], [ - html.h1([attribute.class("font-bold text-4xl")], [element.text(p.title)]), - // todo: add date of publishing - //html.time([], []) - //html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]), - //element.unsafe_raw_html("namespace", "Tag", [], render_doc(p.contents)) - ..render_doc(p.contents) - ]) - ]) - ]) + html.div([attribute.class("flex-auto flex flex-col overflow-none")], [ + html.div( + [ + attribute.class( + "sm:hidden h-10 flex py-2 px-4 border-b border-b-zinc-300 w-full gap-2 backdrop-blur-sm bg-zinc-300/50 dark:bg-zinc-800/50 z-50", + ), + ], + [ + html.label( + [attribute.for("sidebar-toggle"), attribute.class("cursor-pointer")], + [ + element.unsafe_raw_html( + "", + "tag", + [], + "", + ), + ], + ), + html.span([], [element.text(p.title)]), + ], + ), + html.div([attribute.class("h-full sm:flex grid")], [ + html.input([ + attribute.type_("checkbox"), + attribute.id("sidebar-toggle"), + attribute.class("peer hidden"), + ]), + html.div( + [ + attribute.class( + "p-4 border-r border-r-zinc-300 col-start-1 row-start-1 bg-neutral-200 dark:bg-neutral-900 basis-2/10 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 sm:translate-x-0 z-30", + ), + ], + [ + html.ul( + [], + list.map(doc_pages_list, fn(post: #(String, post.Post)) { + html.li([attribute.class("mb-2")], [ + html.a([attribute.href(post.0)], [ + element.text({ post.1 }.title), + ]), + ]) + }), + ), + ], + ), + html.main( + [ + attribute.class( + "mb-4 h-full overflow-y-auto basis-7/7 col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30 px-4 pt-2", + ), + ], + [ + html.h1([attribute.class("mb-2 font-bold text-4xl")], [ + element.text(p.title), + ]), + // todo: add date of publishing + //html.time([], []) + //html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]), + //element.unsafe_raw_html("namespace", "Tag", [], render_doc(p.contents)) + ..render_doc(p.contents) + ], + ), + ]), + ]) } fn render_doc(md: String) { - let renderer = djot.Renderer( - ..djot.default_renderer(), - heading: fn(attrs, level, content) { - let size = case level { - 1 -> "text-4xl" - 2 -> "text-3xl" - 3 -> "text-2xl" - _ -> "text-xl" - } - let attr = dict.insert(attrs, "class", "font-bold " <> size) + let renderer = + djot.Renderer( + ..djot.default_renderer(), + heading: fn(attrs, level, content) { + let size = case level { + 1 -> "text-4xl" + 2 -> "text-3xl" + 3 -> "text-2xl" + _ -> "text-xl" + } + let attr = + dict.insert( + attrs, + "class", + "mb-1 text-neutral-800 dark:text-neutral-300 font-bold " <> size, + ) - case level { - 1 -> html.h1(to_attr(attr), content) - 2 -> html.h2(to_attr(attr), content) - 3 -> html.h3(to_attr(attr), content) - _ -> html.p(to_attr(attr), content) - } - } - ) - djot.render(md, renderer) + case level { + 1 -> html.h1(to_attr(attr), content) + 2 -> html.h2(to_attr(attr), content) + 3 -> html.h3(to_attr(attr), content) + _ -> html.p(to_attr(attr), content) + } + }, + code: fn(content) { + html.code([attribute.class("text-violet-600 dark:text-violet-400")], [ + element.text(content), + ]) + }, + ) + djot.render(md, renderer) } fn to_attr(attrs) { - use attrs, key, val <- dict.fold(attrs, []) - [attribute.attribute(key, val), ..attrs] + use attrs, key, val <- dict.fold(attrs, []) + [attribute.attribute(key, val), ..attrs] } fn render_doc_(md: String) -> String { - // w-full m-2 p-2 bg-neutral-700 - let doc = jot.parse(md) - let updated_content = list.map(doc.content, fn(container) { - case container { - jot.Heading(attributes, level, content) -> { - let size = case level { - 1 -> "text-4xl" - 2 -> "text-3xl" - 3 -> "text-2xl" - _ -> "text-xl" - } - let attr = dict.insert(attributes, "class", "font-bold " <> size) - jot.Heading(attr, level, content) - } - _ -> container - } - }) - echo doc + // w-full m-2 p-2 bg-neutral-700 + let doc = jot.parse(md) + let updated_content = + list.map(doc.content, fn(container) { + case container { + jot.Heading(attributes, level, content) -> { + let size = case level { + 1 -> "text-4xl" + 2 -> "text-3xl" + 3 -> "text-2xl" + _ -> "text-xl" + } + let attr = dict.insert(attributes, "class", "font-bold " <> size) + jot.Heading(attr, level, content) + } + _ -> container + } + }) + echo doc - jot.document_to_html(jot.Document( - content: updated_content, - references: doc.references, - footnotes: doc.footnotes - )) -} - -fn page_(p: post.Post, doc_pages_list) -> element.Element(a) { - html.div([attribute.class("relative h-screen flex")], [ - html.div([attribute.class("-mt-2 -mx-4 py-2 px-4 border-b border-b-zinc-300 flex gap-2 font-semibold")], [ - html.label([attribute.for("sidebar-toggle"), attribute.class("cursor-pointer")], [ - element.unsafe_raw_html("", "tag", [], ""), - ]), - html.span([], [element.text(p.title)]) - ]), - html.div([attribute.class("relative flex")], [ - html.div([attribute.class("absolute top-0 left-0 h-full bg-gray-200 w-64 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 z-30")], [ - html.div([attribute.class("p-4")], [ - html.h2([attribute.class("text-xl font-semibold mb-4")], [element.text("Sidebar")]), - html.ul([], [ - html.li([attribute.class("mb-2")], [element.text("Test")]) - ]) - ]) - ]), - html.input([attribute.type_("checkbox"), attribute.id("sidebar-toggle"), attribute.class("peer hidden")]), - html.main([attribute.class("flex-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:opacity-50")], [ - html.h1([], [element.text(p.title)]), - // todo: add date of publishing - //html.time([], []) - //html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]), - //element.unsafe_raw_html("namespace", "Tag", [], md.md_to_html(p.contents)) - ]) - ]) - ]) + jot.document_to_html(jot.Document( + content: updated_content, + references: doc.references, + footnotes: doc.footnotes, + )) } diff --git a/website/src/website.gleam b/website/src/website.gleam index acc2afae..de264e81 100644 --- a/website/src/website.gleam +++ b/website/src/website.gleam @@ -1,204 +1,298 @@ -import gleam/option -import gleam/dict import gleam/io -import gleam/order import gleam/list +import gleam/option +import gleam/order import gleam/string +import glaml import lustre/attribute import lustre/element import lustre/element/html import lustre/ssg import lustre/ssg/djot -import tom import simplifile -import glaml +import tom import conf -import post -import pages/index import pages/doc +import pages/index +import post pub fn main() { - let assert Ok(files) = simplifile.get_files("./content") - let posts = list.map(files, fn(path: String) { - let assert Ok(ext) = path |> string.split(".") |> list.last - let slug = path |> string.replace("./content", "") |> string.drop_end({ext |> string.length()} + 1) - let assert Ok(name) = slug |> string.split("/") |> list.last + let assert Ok(files) = simplifile.get_files("./content") + let posts = + list.map(files, fn(path: String) { + let assert Ok(ext) = path |> string.split(".") |> list.last + let slug = + path + |> string.replace("./content", "") + |> string.drop_end({ ext |> string.length() } + 1) + let assert Ok(name) = slug |> string.split("/") |> list.last - let assert Ok(content) = simplifile.read(path) - let frontmatter = djot.frontmatter(content) - let metadata = case frontmatter { - Ok(frntmtr) -> { - let assert Ok([metadata]) = glaml.parse_string(frntmtr) - option.Some(metadata) - } - Error(_) -> option.None - } - let content = djot.content(content) + let slug = case name { + "_index" -> slug |> string.drop_end({ "_index" |> string.length() } + 1) + _ -> slug + } - let title = case metadata { - option.Some(metadata) -> { - case glaml.select_sugar(glaml.document_root(metadata), "title") { - Ok(glaml.NodeStr(s)) -> s - _ -> "" - } - - } - option.None -> "" - } + let assert Ok(content) = simplifile.read(path) + let frontmatter = djot.frontmatter(content) + let metadata = case frontmatter { + Ok(frntmtr) -> { + let assert Ok([metadata]) = glaml.parse_string(frntmtr) + option.Some(metadata) + } + Error(_) -> option.None + } + let content = djot.content(content) - let assert Ok(filename) = path |> string.split("/") |> list.last - #(slug, post.Post(name, title, slug, metadata, content)) - }) + let title = case metadata { + option.Some(metadata) -> { + case glaml.select_sugar(glaml.document_root(metadata), "title") { + Ok(glaml.NodeStr(s)) -> s + _ -> "" + } + } + option.None -> "" + } - let doc_pages = list.filter(posts, fn(page) { - let isdoc = is_doc_page(page.0) - //io.debug(page.0) - //io.debug(isdoc) - isdoc - }) |> list.filter(fn(page) { - case page.1.metadata { - option.Some(_) -> True - option.None -> False - } - }) |> list.sort(fn(p1, p2) { - //io.debug(p1) - //io.debug(p2) - let assert option.Some(p1_metadata) = p1.1.metadata - let p1_weight = case glaml.select_sugar(glaml.document_root(p1_metadata), "weight") { - Ok(glaml.NodeInt(w)) -> w - _ -> 0 - } + let assert Ok(filename) = path |> string.split("/") |> list.last + #(slug, post.Post(name, title, slug, metadata, content)) + }) - let assert option.Some(p2_metadata) = p2.1.metadata - let p2_weight = case glaml.select_sugar(glaml.document_root(p2_metadata), "weight") { - Ok(glaml.NodeInt(w)) -> w - _ -> 0 - } + let doc_pages = + list.filter(posts, fn(page) { + let isdoc = is_doc_page(page.0) + //io.debug(page.0) + //io.debug(isdoc) + isdoc + }) + |> list.filter(fn(page) { + case { page.1 }.metadata { + option.Some(_) -> True + option.None -> False + } + }) + |> list.sort(fn(p1, p2) { + //io.debug(p1) + //io.debug(p2) + let assert option.Some(p1_metadata) = { p1.1 }.metadata + let p1_weight = case + glaml.select_sugar(glaml.document_root(p1_metadata), "weight") + { + Ok(glaml.NodeInt(w)) -> w + _ -> 0 + } - case p1_weight == 0 { - True -> order.Eq - False -> { - case p1_weight < p2_weight { - True -> order.Lt - False -> order.Gt - } - } - } - }) + let assert option.Some(p2_metadata) = { p2.1 }.metadata + let p2_weight = case + glaml.select_sugar(glaml.document_root(p2_metadata), "weight") + { + Ok(glaml.NodeInt(w)) -> w + _ -> 0 + } - let build = ssg.new("./public") - |> ssg.add_static_dir("static") - |> ssg.add_static_route("/", create_page(index.page())) - |> list.fold(posts, _, fn(config, post) { - let route = case post.1.name { - "_index" -> post.0 |> string.drop_end("_index" |> string.length()) - _ -> post.0 - } - + case p1_weight == 0 { + True -> { + case p1_weight == 0 { + True -> order.Eq + False -> + case p1_weight > p2_weight { + True -> order.Lt + False -> order.Gt + } + } + } + False -> { + case p1_weight > p2_weight { + True -> order.Lt + False -> order.Gt + } + } + } + }) - let page = case is_doc_page(post.0) { - True -> doc.page(post.1, doc_pages) - False -> doc.page(post.1, doc_pages) - } - ssg.add_static_route(config, route, create_page(page)) - }) - |> ssg.use_index_routes - |> ssg.build + let build = + ssg.new("./public") + |> ssg.add_static_dir("static") + |> ssg.add_static_route("/", create_page(index.page())) + |> list.fold(posts, _, fn(config, post) { + let route = case { post.1 }.name { + "_index" -> post.0 |> string.drop_end("_index" |> string.length()) + _ -> post.0 + } - case build { - Ok(_) -> io.println("Website successfully built!") - Error(e) -> { - io.debug(e) - io.println("Website could not be built.") - } - } + let page = case is_doc_page(post.0) { + True -> doc.page(post.1, doc_pages) + False -> doc.page(post.1, doc_pages) + } + ssg.add_static_route(config, route, create_page(page)) + }) + |> ssg.use_index_routes + |> ssg.build + + case build { + Ok(_) -> io.println("Website successfully built!") + Error(e) -> { + io.debug(e) + io.println("Website could not be built.") + } + } } fn is_doc_page(slug: String) { - case slug { - "/docs" <> _ -> True - _ -> False - } + case slug { + "/docs" <> _ -> True + _ -> False + } } fn nav() -> element.Element(a) { - html.nav([attribute.class("flex sticky top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-12")], [ - html.div([attribute.class("flex my-auto px-2")], [ - html.div([], [ - html.a([attribute.href("/"), attribute.class("flex items-center gap-1")], [ - html.img([ - attribute.src("/hilbish-flower.png"), - attribute.class("h-6") - ]), - html.span([ - attribute.class("self-center text-2xl") - ], [ - element.text("Hilbish"), - ]), - ]), - ]) - ]), - ]) + html.nav( + [ + attribute.class( + "bg-stone-50/80 dark:bg-neutral-900/80 flex justify-around sticky items-center top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-18", + ), + ], + [ + html.div([attribute.class("flex my-auto px-2")], [ + html.div([], [ + html.a( + [attribute.href("/"), attribute.class("flex items-center gap-1")], + [ + html.img([ + attribute.src("/hilbish-flower.png"), + attribute.class("h-16"), + ]), + html.span([attribute.class("self-center text-3xl font-medium")], [ + element.text("Hilbish"), + ]), + ], + ), + ]), + ]), + html.div( + [attribute.class("flex gap-3 dark:text-pink-300 text-pink-600")], + [ + html.a([attribute.href("/")], [element.text("Home")]), + html.a([attribute.href("/install")], [element.text("Install")]), + html.a([attribute.href("/docs")], [element.text("Docs")]), + html.a([attribute.href("/blog")], [element.text("Blog")]), + ], + ), + ], + ) } fn footer() -> element.Element(a) { - html.footer([attribute.class("py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300")], [ - html.div([attribute.class("flex flex-col")], [ - html.a([attribute.href(conf.base_url), attribute.class("flex items-center gap-1")], [ - html.img([ - attribute.src("/hilbish-flower.png"), - attribute.class("h-24") - ]), - html.span([ - attribute.class("self-center text-6xl") - ], [ - element.text("Hilbish"), - ]), - ]), - html.span([attribute.class("text-xl")], [element.text("The Moon-powered shell!")]), - html.span([attribute.class("text-light text-neutral-500")], [element.text("MIT License, copyright sammyette 2025")]) - ]), - html.div([attribute.class("flex flex-col")], [ - link("https://github.com/Rosettea/Hilbish", "GitHub") - ]) - ]) + html.footer( + [ + attribute.class( + "py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300", + ), + ], + [ + html.div([attribute.class("flex flex-col")], [ + html.a( + [ + attribute.href(conf.base_url), + attribute.class("flex items-center gap-1"), + ], + [ + html.img([ + attribute.src("/hilbish-flower.png"), + attribute.class("h-24"), + ]), + html.span([attribute.class("self-center text-6xl")], [ + element.text("Hilbish"), + ]), + ], + ), + html.span([attribute.class("text-xl")], [ + element.text("The Moon-powered shell!"), + ]), + html.span([attribute.class("text-light text-neutral-500")], [ + element.text("MIT License, copyright sammyette 2025"), + ]), + ]), + html.div([attribute.class("flex flex-col")], [ + link("https://github.com/Rosettea/Hilbish", "GitHub"), + ]), + ], + ) } -fn create_page(content: element.Element(a)) -> element.Element(a) { - let description = "Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua." - html.html([attribute.class("bg-stone-50 dark:bg-neutral-900 text-black dark:text-white")], [ - html.head([], [ - html.meta([ - attribute.name("viewport"), - attribute.attribute("content", "width=device-width, initial-scale=1.0") - ]), - html.link([ - attribute.rel("stylesheet"), - attribute.href(conf.base_url_join("tailwind.css")) - ]), - html.title([], "Hilbish"), - html.meta([attribute.name("theme-color"), attribute.content("#ff89dd")]), - html.meta([attribute.content(conf.base_url_join("hilbish-flower.png")), attribute.attribute("property", "og:image")]), - html.meta([attribute.content("Hilbish"), attribute.attribute("property", "og:title")]), // this should be same as title - html.meta([attribute.content("Hilbish"), attribute.attribute("property", "og:site_name")]), - html.meta([attribute.content("website"), attribute.attribute("property", "og:type")]), - html.meta([attribute.content(description), attribute.attribute("property", "og:description")]), - html.meta([attribute.content(description), attribute.name("description")]), - html.meta([attribute.name("keywords"), attribute.content("Lua,Shell,Hilbish,Linux,zsh,bash")]), - html.meta([attribute.content(conf.base_url), attribute.attribute("property", "og:url")]) - ]), - html.body([attribute.class("min-h-screen flex flex-col")], [ - nav(), - content, - footer(), - ]) - ]) +fn create_page(content: element.Element(a)) -> element.Element(a) { + let description = + "Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua." + + html.html( + [ + attribute.class( + "bg-stone-50 dark:bg-neutral-900 text-black dark:text-white", + ), + ], + [ + html.head([], [ + html.meta([ + attribute.name("viewport"), + attribute.attribute( + "content", + "width=device-width, initial-scale=1.0", + ), + ]), + html.link([ + attribute.rel("stylesheet"), + attribute.href(conf.base_url_join("tailwind.css")), + ]), + html.title([], "Hilbish"), + html.meta([attribute.name("theme-color"), attribute.content("#ff89dd")]), + html.meta([ + attribute.content(conf.base_url_join("hilbish-flower.png")), + attribute.attribute("property", "og:image"), + ]), + html.meta([ + attribute.content("Hilbish"), + attribute.attribute("property", "og:title"), + ]), + // this should be same as title + html.meta([ + attribute.content("Hilbish"), + attribute.attribute("property", "og:site_name"), + ]), + html.meta([ + attribute.content("website"), + attribute.attribute("property", "og:type"), + ]), + html.meta([ + attribute.content(description), + attribute.attribute("property", "og:description"), + ]), + html.meta([ + attribute.content(description), + attribute.name("description"), + ]), + html.meta([ + attribute.name("keywords"), + attribute.content("Lua,Shell,Hilbish,Linux,zsh,bash"), + ]), + html.meta([ + attribute.content(conf.base_url), + attribute.attribute("property", "og:url"), + ]), + ]), + html.body([attribute.class("min-h-screen flex flex-col")], [ + nav(), + content, + footer(), + ]), + ], + ) } fn link(url: String, text: String) { - html.a([attribute.href(url)], [ - html.span([attribute.class("text-pink-300 text-light")], [element.text(text)]) - ]) + html.a([attribute.href(url)], [ + html.span([attribute.class("text-pink-300 text-light")], [ + element.text(text), + ]), + ]) }