docs: add separators for types, make object properties into tables

pull/260/head
sammyette 2023-09-02 16:11:57 -04:00
parent 0900284304
commit 7fd2ed391b
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
6 changed files with 54 additions and 29 deletions

View File

@ -480,7 +480,7 @@ func main() {
} }
if len(modu.Fields) != 0 { if len(modu.Fields) != 0 {
f.WriteString("## Interface fields\n") f.WriteString("## Static module fields\n")
mdTable := md.NewTable(len(modu.Fields), 2) mdTable := md.NewTable(len(modu.Fields), 2)
mdTable.SetTitle(0, "") mdTable.SetTitle(0, "")
@ -496,11 +496,17 @@ func main() {
} }
if len(modu.Properties) != 0 { if len(modu.Properties) != 0 {
f.WriteString("## Object properties\n") f.WriteString("## Object properties\n")
for _, dps := range modu.Properties {
f.WriteString(fmt.Sprintf("- `%s`: ", dps.FuncName)) mdTable := md.NewTable(len(modu.Fields), 2)
f.WriteString(strings.Join(dps.Doc, " ")) mdTable.SetTitle(0, "")
f.WriteString("\n") mdTable.SetTitle(1, "")
for i, dps := range modu.Properties {
mdTable.SetContent(i, 0, dps.FuncName)
mdTable.SetContent(i, 1, strings.Join(dps.Doc, " "))
} }
f.WriteString(mdTable.String())
f.WriteString("\n") f.WriteString("\n")
} }
@ -563,6 +569,7 @@ func main() {
if len(modu.Types) != 0 { if len(modu.Types) != 0 {
f.WriteString("## Types\n") f.WriteString("## Types\n")
for _, dps := range modu.Types { for _, dps := range modu.Types {
f.WriteString("<hr>\n\n")
f.WriteString(fmt.Sprintf("## %s\n", dps.FuncName)) f.WriteString(fmt.Sprintf("## %s\n", dps.FuncName))
for _, doc := range dps.Doc { for _, doc := range dps.Doc {
if !strings.HasPrefix(doc, "---") { if !strings.HasPrefix(doc, "---") {
@ -570,12 +577,18 @@ func main() {
} }
} }
if len(dps.Properties) != 0 { if len(dps.Properties) != 0 {
f.WriteString("### Properties\n") f.WriteString("## Object properties\n")
for _, dps := range dps.Properties {
f.WriteString(fmt.Sprintf("- `%s`: ", dps.FuncName)) mdTable := md.NewTable(len(dps.Properties), 2)
f.WriteString(strings.Join(dps.Doc, " ")) mdTable.SetTitle(0, "")
f.WriteString("\n") mdTable.SetTitle(1, "")
for i, d := range dps.Properties {
mdTable.SetContent(i, 0, d.FuncName)
mdTable.SetContent(i, 1, strings.Join(d.Doc, " "))
} }
f.WriteString(mdTable.String())
f.WriteString("\n")
} }
f.WriteString("\n") f.WriteString("\n")
f.WriteString("### Methods\n") f.WriteString("### Methods\n")

View File

@ -33,7 +33,7 @@ interfaces and functions which directly relate to shell functionality.
|<a href="#timeout">timeout(cb, time) -> @Timer</a>|Runs the `cb` function after `time` in milliseconds.| |<a href="#timeout">timeout(cb, time) -> @Timer</a>|Runs the `cb` function after `time` in milliseconds.|
|<a href="#which">which(name) -> string</a>|Checks if `name` is a valid command.| |<a href="#which">which(name) -> string</a>|Checks if `name` is a valid command.|
## Interface fields ## Static module fields
||| |||
|----|----| |----|----|
|ver|The version of Hilbish| |ver|The version of Hilbish|
@ -316,7 +316,9 @@ Will return the path of the binary, or a basename if it's a commander.
This function has no parameters. This function has no parameters.
</div> </div>
<hr><div id='luaSinkAutoFlush'><hr><div id='luaSinkFlush'><hr><div id='luaSinkRead'><hr><div id='luaSinkWrite'><hr><div id='luaSinkWriteln'>## Types ## Types
<hr>
## Sink ## Sink
A sink is a structure that has input and/or output to/from A sink is a structure that has input and/or output to/from
a desination. a desination.

View File

@ -24,7 +24,7 @@ interactive usage or with the functions defined below for use in external runner
|<a href="#jobs.last">last() -> @Job</a>|Returns the last added job from the table.| |<a href="#jobs.last">last() -> @Job</a>|Returns the last added job from the table.|
## Functions ## Functions
<hr><div id='jobs.background'><hr><div id='jobs.foreground'><hr><div id='jobs.start'><hr><div id='jobs.stop'><hr><div id='jobs.add'> <hr><div id='jobs.add'>
<h4 class='heading'> <h4 class='heading'>
hilbish.jobs.add(cmdstr, args, execPath) hilbish.jobs.add(cmdstr, args, execPath)
<a href="#jobs.add" class='heading-link'> <a href="#jobs.add" class='heading-link'>
@ -90,16 +90,21 @@ This function has no parameters.
</div> </div>
## Types ## Types
<hr>
## Job ## Job
The Job type describes a Hilbish job. The Job type describes a Hilbish job.
### Properties ## 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 |cmd|The user entered command string for the job.|
- `pid`: The Process ID |running|Whether the job is running or not.|
- `exitCode`: The last exit code of the job. |id|The ID of the job in the job table|
- `stdout`: The standard output of the job. This just means the normal logs of the process. |pid|The Process ID|
- `stderr`: The standard error stream of the process. This (usually) includes error messages of the job. |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 ### Methods
#### background() #### background()

View File

@ -12,7 +12,7 @@ The `os` interface provides simple text information properties about
the current OS on the systen. This mainly includes the name and the current OS on the systen. This mainly includes the name and
version. version.
## Interface fields ## Static module fields
||| |||
|----|----| |----|----|
|family|Family name of the current OS| |family|Family name of the current OS|

View File

@ -36,14 +36,14 @@ print(t.running) // true
|<a href="#timers.create">create(type, time, callback) -> @Timer</a>|Creates a timer that runs based on the specified `time` in milliseconds.| |<a href="#timers.create">create(type, time, callback) -> @Timer</a>|Creates a timer that runs based on the specified `time` in milliseconds.|
|<a href="#timers.get">get(id) -> @Timer</a>|Retrieves a timer via its ID.| |<a href="#timers.get">get(id) -> @Timer</a>|Retrieves a timer via its ID.|
## Interface fields ## Static module fields
||| |||
|----|----| |----|----|
|INTERVAL|Constant for an interval timer type| |INTERVAL|Constant for an interval timer type|
|TIMEOUT|Constant for a timeout timer type| |TIMEOUT|Constant for a timeout timer type|
## Functions ## Functions
<hr><div id='timers.start'><hr><div id='timers.stop'><hr><div id='timers.create'> <hr><div id='timers.create'>
<h4 class='heading'> <h4 class='heading'>
hilbish.timers.create(type, time, callback) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a> hilbish.timers.create(type, time, callback) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#timers.create" class='heading-link'> <a href="#timers.create" class='heading-link'>
@ -71,12 +71,17 @@ This function has no parameters.
</div> </div>
## Types ## Types
<hr>
## Timer ## Timer
The Job type describes a Hilbish timer. The Job type describes a Hilbish timer.
### Properties ## 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 |type|What type of timer it is|
|running|If the timer is running|
|duration|The duration in milliseconds that the timer will run|
### Methods ### Methods
#### start() #### start()

View File

@ -12,7 +12,7 @@ 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 It is equivalent to XDG on Linux and gets the user's preferred directories
for configs and data. for configs and data.
## Interface fields ## Static module fields
||| |||
|----|----| |----|----|
|config|The user's config directory| |config|The user's config directory|