Skip to content

Commit

Permalink
feat(commands/doc): display separator, add space in code block
Browse files Browse the repository at this point in the history
  • Loading branch information
TorchedSammy committed Dec 18, 2023
1 parent 42d86f2 commit 2cac53d
Show file tree
Hide file tree
Showing 18 changed files with 161 additions and 75 deletions.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ hilbish.appendPath '~/go/bin'
-- Will add ~/go/bin to the command path.
-- Or do multiple:
hilbush.appendPath {
hilbish.appendPath {
'~/go/bin',
'~/.local/bin'
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func main() {
if dps.IsMember {
continue
}
f.WriteString(fmt.Sprintf("<hr><div id='%s'>", dps.FuncName))
f.WriteString(fmt.Sprintf("<hr>\n<div id='%s'>", dps.FuncName))
htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(modname + "." + dps.FuncSig, "<", `\<`, -1), func(typ string) string {
typName := typ[1:]
typLookup := typeTable[strings.ToLower(typName)]
Expand Down
15 changes: 10 additions & 5 deletions docs/api/bait.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ this function will set the user prompt.
|<a href="#release">release(name, catcher)</a>|Removes the `catcher` for the event with `name`.|
|<a href="#throw">throw(name, ...args)</a>|Throws a hook with `name` with the provided `args`.|

<hr><div id='catch'>
<hr>
<div id='catch'>
<h4 class='heading'>
bait.catch(name, cb)
<a href="#catch" class='heading-link'>
Expand All @@ -67,7 +68,8 @@ end)
```
</div>

<hr><div id='catchOnce'>
<hr>
<div id='catchOnce'>
<h4 class='heading'>
bait.catchOnce(name, cb)
<a href="#catchOnce" class='heading-link'>
Expand All @@ -85,7 +87,8 @@ The function that will be called when the event is thrown.

</div>

<hr><div id='hooks'>
<hr>
<div id='hooks'>
<h4 class='heading'>
bait.hooks(name) -> table
<a href="#hooks" class='heading-link'>
Expand All @@ -100,7 +103,8 @@ The name of the function

</div>

<hr><div id='release'>
<hr>
<div id='release'>
<h4 class='heading'>
bait.release(name, catcher)
<a href="#release" class='heading-link'>
Expand Down Expand Up @@ -132,7 +136,8 @@ bait.release('event', hookCallback)
```
</div>

<hr><div id='throw'>
<hr>
<div id='throw'>
<h4 class='heading'>
bait.throw(name, ...args)
<a href="#throw" class='heading-link'>
Expand Down
6 changes: 4 additions & 2 deletions docs/api/commander.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ This sink is for writing errors, as the name would suggest.
|<a href="#deregister">deregister(name)</a>|Removes the named command. Note that this will only remove Commander-registered commands.|
|<a href="#register">register(name, cb)</a>|Adds a new command with the given `name`. When Hilbish has to run a command with a name,|

<hr><div id='deregister'>
<hr>
<div id='deregister'>
<h4 class='heading'>
commander.deregister(name)
<a href="#deregister" class='heading-link'>
Expand All @@ -57,7 +58,8 @@ Name of the command to remove.

</div>

<hr><div id='register'>
<hr>
<div id='register'>
<h4 class='heading'>
commander.register(name, cb)
<a href="#register" class='heading-link'>
Expand Down
27 changes: 18 additions & 9 deletions docs/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ library offers more functions and will work on any operating system Hilbish does
|----|----|
|pathSep|The operating system's path separator.|

<hr><div id='abs'>
<hr>
<div id='abs'>
<h4 class='heading'>
fs.abs(path) -> string
<a href="#abs" class='heading-link'>
Expand All @@ -47,7 +48,8 @@ This can be used to resolve short paths like `..` to `/home/user`.

</div>

<hr><div id='basename'>
<hr>
<div id='basename'>
<h4 class='heading'>
fs.basename(path) -> string
<a href="#basename" class='heading-link'>
Expand All @@ -63,7 +65,8 @@ Path to get the base name of.

</div>

<hr><div id='cd'>
<hr>
<div id='cd'>
<h4 class='heading'>
fs.cd(dir)
<a href="#cd" class='heading-link'>
Expand All @@ -78,7 +81,8 @@ Path to change directory to.

</div>

<hr><div id='dir'>
<hr>
<div id='dir'>
<h4 class='heading'>
fs.dir(path) -> string
<a href="#dir" class='heading-link'>
Expand All @@ -94,7 +98,8 @@ Path to get the directory for.

</div>

<hr><div id='glob'>
<hr>
<div id='glob'>
<h4 class='heading'>
fs.glob(pattern) -> matches (table)
<a href="#glob" class='heading-link'>
Expand Down Expand Up @@ -125,7 +130,8 @@ print(matches)
```
</div>

<hr><div id='join'>
<hr>
<div id='join'>
<h4 class='heading'>
fs.join(...path) -> string
<a href="#join" class='heading-link'>
Expand All @@ -148,7 +154,8 @@ print(fs.join(hilbish.userDir.config, 'hilbish'))
```
</div>

<hr><div id='mkdir'>
<hr>
<div id='mkdir'>
<h4 class='heading'>
fs.mkdir(name, recursive)
<a href="#mkdir" class='heading-link'>
Expand All @@ -175,7 +182,8 @@ Whether to create parent directories for the provided name
```
</div>

<hr><div id='readdir'>
<hr>
<div id='readdir'>
<h4 class='heading'>
fs.readdir(path) -> table[string]
<a href="#readdir" class='heading-link'>
Expand All @@ -190,7 +198,8 @@ Returns a list of all files and directories in the provided path.

</div>

<hr><div id='stat'>
<hr>
<div id='stat'>
<h4 class='heading'>
fs.stat(path) -> {}
<a href="#stat" class='heading-link'>
Expand Down
56 changes: 37 additions & 19 deletions docs/api/hilbish/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ interfaces and functions which directly relate to shell functionality.
|vimMode|Current Vim input mode of Hilbish (will be nil if not in Vim input mode)|
|exitCode|Exit code of the last executed command|

<hr><div id='alias'>
<hr>
<div id='alias'>
<h4 class='heading'>
hilbish.alias(cmd, orig)
<a href="#alias" class='heading-link'>
Expand Down Expand Up @@ -75,7 +76,8 @@ hilbish.alias('dircount', 'ls %1 | wc -l')
```
</div>

<hr><div id='appendPath'>
<hr>
<div id='appendPath'>
<h4 class='heading'>
hilbish.appendPath(dir)
<a href="#appendPath" class='heading-link'>
Expand All @@ -96,14 +98,15 @@ hilbish.appendPath '~/go/bin'
-- Will add ~/go/bin to the command path.

-- Or do multiple:
hilbush.appendPath {
hilbish.appendPath {
'~/go/bin',
'~/.local/bin'
}
```
</div>

<hr><div id='complete'>
<hr>
<div id='complete'>
<h4 class='heading'>
hilbish.complete(scope, cb)
<a href="#complete" class='heading-link'>
Expand All @@ -125,7 +128,8 @@ provides more details.

</div>

<hr><div id='cwd'>
<hr>
<div id='cwd'>
<h4 class='heading'>
hilbish.cwd() -> string
<a href="#cwd" class='heading-link'>
Expand All @@ -138,7 +142,8 @@ Returns the current directory of the shell
This function has no parameters.
</div>

<hr><div id='exec'>
<hr>
<div id='exec'>
<h4 class='heading'>
hilbish.exec(cmd)
<a href="#exec" class='heading-link'>
Expand All @@ -154,7 +159,8 @@ This can be used to do an in-place restart.

</div>

<hr><div id='goro'>
<hr>
<div id='goro'>
<h4 class='heading'>
hilbish.goro(fn)
<a href="#goro" class='heading-link'>
Expand All @@ -171,7 +177,8 @@ This can be used to run any function in another thread.

</div>

<hr><div id='highlighter'>
<hr>
<div id='highlighter'>
<h4 class='heading'>
hilbish.highlighter(line)
<a href="#highlighter" class='heading-link'>
Expand All @@ -198,7 +205,8 @@ end
```
</div>

<hr><div id='hinter'>
<hr>
<div id='hinter'>
<h4 class='heading'>
hilbish.hinter(line, pos)
<a href="#hinter" class='heading-link'>
Expand Down Expand Up @@ -229,7 +237,8 @@ end
```
</div>

<hr><div id='inputMode'>
<hr>
<div id='inputMode'>
<h4 class='heading'>
hilbish.inputMode(mode)
<a href="#inputMode" class='heading-link'>
Expand All @@ -246,7 +255,8 @@ Vim-like with modes and Vim keybinds.

</div>

<hr><div id='interval'>
<hr>
<div id='interval'>
<h4 class='heading'>
hilbish.interval(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#interval" class='heading-link'>
Expand All @@ -265,7 +275,8 @@ This creates a timer that starts immediately.

</div>

<hr><div id='multiprompt'>
<hr>
<div id='multiprompt'>
<h4 class='heading'>
hilbish.multiprompt(str)
<a href="#multiprompt" class='heading-link'>
Expand Down Expand Up @@ -301,7 +312,8 @@ hilbish.multiprompt '-->'
```
</div>

<hr><div id='prependPath'>
<hr>
<div id='prependPath'>
<h4 class='heading'>
hilbish.prependPath(dir)
<a href="#prependPath" class='heading-link'>
Expand All @@ -316,7 +328,8 @@ Prepends `dir` to $PATH.

</div>

<hr><div id='prompt'>
<hr>
<div id='prompt'>
<h4 class='heading'>
hilbish.prompt(str, typ)
<a href="#prompt" class='heading-link'>
Expand Down Expand Up @@ -348,7 +361,8 @@ hilbish.prompt '%u@%h :%d $'
```
</div>

<hr><div id='read'>
<hr>
<div id='read'>
<h4 class='heading'>
hilbish.read(prompt) -> input (string)
<a href="#read" class='heading-link'>
Expand All @@ -365,7 +379,8 @@ Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which s

</div>

<hr><div id='run'>
<hr>
<div id='run'>
<h4 class='heading'>
hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)
<a href="#run" class='heading-link'>
Expand All @@ -383,7 +398,8 @@ If this is true, the function will return the standard output and error of the c

</div>

<hr><div id='runnerMode'>
<hr>
<div id='runnerMode'>
<h4 class='heading'>
hilbish.runnerMode(mode)
<a href="#runnerMode" class='heading-link'>
Expand All @@ -402,7 +418,8 @@ will call it to execute user input instead.

</div>

<hr><div id='timeout'>
<hr>
<div id='timeout'>
<h4 class='heading'>
hilbish.timeout(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
<a href="#timeout" class='heading-link'>
Expand All @@ -421,7 +438,8 @@ This creates a Timer that starts immediately.

</div>

<hr><div id='which'>
<hr>
<div id='which'>
<h4 class='heading'>
hilbish.which(name) -> string
<a href="#which" class='heading-link'>
Expand Down
Loading

0 comments on commit 2cac53d

Please sign in to comment.