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 {
f.WriteString("## Interface fields\n")
f.WriteString("## Static module fields\n")
mdTable := md.NewTable(len(modu.Fields), 2)
mdTable.SetTitle(0, "")
@ -496,11 +496,17 @@ func main() {
}
if len(modu.Properties) != 0 {
f.WriteString("## Object properties\n")
for _, dps := range modu.Properties {
f.WriteString(fmt.Sprintf("- `%s`: ", dps.FuncName))
f.WriteString(strings.Join(dps.Doc, " "))
f.WriteString("\n")
mdTable := md.NewTable(len(modu.Fields), 2)
mdTable.SetTitle(0, "")
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")
}
@ -563,6 +569,7 @@ func main() {
if len(modu.Types) != 0 {
f.WriteString("## Types\n")
for _, dps := range modu.Types {
f.WriteString("<hr>\n\n")
f.WriteString(fmt.Sprintf("## %s\n", dps.FuncName))
for _, doc := range dps.Doc {
if !strings.HasPrefix(doc, "---") {
@ -570,12 +577,18 @@ func main() {
}
}
if len(dps.Properties) != 0 {
f.WriteString("### Properties\n")
for _, dps := range dps.Properties {
f.WriteString(fmt.Sprintf("- `%s`: ", dps.FuncName))
f.WriteString(strings.Join(dps.Doc, " "))
f.WriteString("\n")
f.WriteString("## Object properties\n")
mdTable := md.NewTable(len(dps.Properties), 2)
mdTable.SetTitle(0, "")
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("### 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="#which">which(name) -> string</a>|Checks if `name` is a valid command.|
## Interface fields
## Static module fields
|||
|----|----|
|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.
</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
A sink is a structure that has input and/or output to/from
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.|
## 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'>
hilbish.jobs.add(cmdstr, args, execPath)
<a href="#jobs.add" class='heading-link'>
@ -90,16 +90,21 @@ This function has no parameters.
</div>
## Types
<hr>
## Job
The Job type describes a Hilbish job.
### 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.
## 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()

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
version.
## Interface fields
## Static module fields
|||
|----|----|
|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.get">get(id) -> @Timer</a>|Retrieves a timer via its ID.|
## Interface fields
## Static module fields
|||
|----|----|
|INTERVAL|Constant for an interval timer type|
|TIMEOUT|Constant for a timeout timer type|
## Functions
<hr><div id='timers.start'><hr><div id='timers.stop'><hr><div id='timers.create'>
<hr><div id='timers.create'>
<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>
<a href="#timers.create" class='heading-link'>
@ -71,12 +71,17 @@ This function has no parameters.
</div>
## Types
<hr>
## Timer
The Job type describes a Hilbish timer.
### Properties
- `type`: What type of timer it is
- `running`: If the timer is running
- `duration`: The duration in milliseconds that the timer will run
## 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()

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
for configs and data.
## Interface fields
## Static module fields
|||
|----|----|
|config|The user's config directory|