From 702c75c0c257ea18b4e5a66b68019f3bb10c9453 Mon Sep 17 00:00:00 2001 From: sammyette Date: Wed, 2 Apr 2025 22:56:35 -0400 Subject: [PATCH] fix(docs): add back sink --- cmd/docgen/docgen.go | 30 ++++++++++++++++++-------- docs/api/hilbish/_index.md | 26 ++++++++++++++++++++++ emmyLuaDocs/hilbish.lua | 44 +++++++++++++++++++------------------- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index 09a5297..59d8047 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -204,6 +204,7 @@ func setupDocType(mod string, typ *doc.Type) *docPiece { } typeTable[strings.ToLower(typeName)] = []string{parentMod, interfaces} + println(typeName, parentMod, interfaces) return dps } @@ -325,7 +326,7 @@ provided by Hilbish. os.Mkdir("emmyLuaDocs", 0777) - dirs := []string{"./util", "./"} + dirs := []string{"./", "./util"} filepath.Walk("golibs/", func (path string, info os.FileInfo, err error) error { if !info.IsDir() { return nil @@ -436,14 +437,25 @@ provided by Hilbish. interfaceModules[modname].Types = append(interfaceModules[modname].Types, piece) } - docs[mod] = module{ - Types: filteredTypePieces, - Docs: filteredPieces, - ShortDescription: shortDesc, - Description: strings.Join(desc, "\n"), - HasInterfaces: hasInterfaces, - Properties: docPieceTag("property", tags), - Fields: docPieceTag("field", tags), + println(mod) + fmt.Println(filteredTypePieces) + if newDoc, ok := docs[mod]; ok { + println("fuck") + oldMod := docs[mod] + newDoc.Types = append(filteredTypePieces, oldMod.Types...) + newDoc.Docs = append(filteredPieces, oldMod.Docs...) + + 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), + } } } diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md index 60e5323..6f31313 100644 --- a/docs/api/hilbish/_index.md +++ b/docs/api/hilbish/_index.md @@ -448,6 +448,32 @@ Will return the path of the binary, or a basename if it's a commander. +## 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. +

diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua index e1ff9f2..4b4bd8f 100644 --- a/emmyLuaDocs/hilbish.lua +++ b/emmyLuaDocs/hilbish.lua @@ -2,28 +2,6 @@ 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 @@ -234,4 +212,26 @@ function hilbish.timers.create(type, time, callback) end --- Retrieves a timer via its ID. function hilbish.timers.get(id) end +--- 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 + return hilbish