diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index 11f41db..a14742d 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -11,6 +11,8 @@ import ( "strings" "os" "sync" + + md "github.com/atsushinee/go-markdown-generator/doc" ) var header = `--- @@ -448,6 +450,35 @@ func main() { return fmt.Sprintf(`%s`, linkedTyp, typName) }) f.WriteString(fmt.Sprintf("## Introduction\n%s\n\n", modDescription)) + if len(modu.Docs) != 0 { + funcCount := 0 + for _, dps := range modu.Docs { + if dps.IsMember { + continue + } + funcCount++ + } + + f.WriteString("## Functions\n") + + mdTable := md.NewTable(funcCount, 2) + mdTable.SetTitle(0, "") + mdTable.SetTitle(1, "") + + diff := 0 + for i, dps := range modu.Docs { + if dps.IsMember { + diff++ + continue + } + + mdTable.SetContent(i - diff, 0, fmt.Sprintf(`%s`, dps.FuncName, dps.FuncSig)) + mdTable.SetContent(i - diff, 1, dps.Doc[0]) + } + f.WriteString(mdTable.String()) + f.WriteString("\n") + } + if len(modu.Fields) != 0 { f.WriteString("## Interface fields\n") for _, dps := range modu.Fields { @@ -468,8 +499,9 @@ func main() { } if len(modu.Docs) != 0 { - f.WriteString("## Functions\n") + //f.WriteString("## Functions\n") for _, dps := range modu.Docs { + f.WriteString(fmt.Sprintf("
", dps.FuncName)) if dps.IsMember { continue } @@ -483,7 +515,15 @@ func main() { 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("### %s\n", htmlSig)) + f.WriteString(fmt.Sprintf(` +

+%s + + + +

+ +`, htmlSig, dps.FuncName)) for _, doc := range dps.Doc { if !strings.HasPrefix(doc, "---") { f.WriteString(doc + "\n") @@ -509,7 +549,7 @@ func main() { f.WriteString(strings.Join(p.Doc, " ")) f.WriteString("\n\n") } - f.WriteString("\n") + f.WriteString("
") } } diff --git a/docs/api/bait.md b/docs/api/bait.md index c464563..292152f 100644 --- a/docs/api/bait.md +++ b/docs/api/bait.md @@ -21,7 +21,7 @@ You can act on events via callback functions. Examples of this are in the Hilbish default config! Consider this part of it: -``` +```lua bait.catch('command.exit', function(code) running = false doPrompt(code ~= 0) @@ -33,31 +33,73 @@ What this does is, whenever the `command.exit` event is thrown, this function will set the user prompt. ## Functions -### bait.catch(name, cb) +||| +|----|----| +|catch(name, cb)|Catches a hook with `name`. Runs the `cb` when it is thrown| +|catchOnce(name, cb)|Same as catch, but only runs the `cb` once and then removes the hook| +|hooks(name) -> table|Returns a table with hooks (callback functions) on the event with `name`.| +|release(name, catcher)|Removes the `catcher` for the event with `name`.| +|throw(name, ...args)|Throws a hook with `name` with the provided `args`| + +
+

+bait.catch(name, cb) + + + +

+ Catches a hook with `name`. Runs the `cb` when it is thrown #### Parameters `string` **`name`** ummm +`function` **`cb`** +? + +

+

+bait.catchOnce(name, cb) + + + +

-### bait.catchOnce(name, cb) Same as catch, but only runs the `cb` once and then removes the hook #### Parameters This function has no parameters. +

+

+bait.hooks(name) -> table + + + +

-### bait.hooks(name) -> table Returns a table with hooks (callback functions) on the event with `name`. #### Parameters This function has no parameters. +

+

+bait.release(name, catcher) + + + +

-### 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 This function has no parameters. +

+

+bait.throw(name, ...args) + + + +

-### bait.throw(name, ...args) Throws a hook with `name` with the provided `args` #### Parameters `string` **`name`** @@ -66,4 +108,4 @@ The name of the hook. `any` **`args`** (This type is variadic. You can pass an infinite amount of parameters with this type.) The arguments to pass to the hook. - +
\ No newline at end of file diff --git a/docs/api/commander.md b/docs/api/commander.md index aa0849e..72140ad 100644 --- a/docs/api/commander.md +++ b/docs/api/commander.md @@ -38,13 +38,31 @@ output should go. name would suggest. ## Functions -### commander.deregister(name) +||| +|----|----| +|deregister(name)|Deregisters any command registered with `name`| +|register(name, cb)|Register a command with `name` that runs `cb` when ran| + +
+

+commander.deregister(name) + + + +

+ Deregisters any command registered with `name` #### Parameters This function has no parameters. +

+

+commander.register(name, cb) + + + +

-### commander.register(name, cb) Register a command with `name` that runs `cb` when ran #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/fs.md b/docs/api/fs.md index e6e8f87..64a2092 100644 --- a/docs/api/fs.md +++ b/docs/api/fs.md @@ -13,51 +13,118 @@ and other things, and acts an addition to the Lua standard library's I/O and filesystem functions. ## Functions -### fs.abs(path) -> string +||| +|----|----| +|abs(path) -> string|Gives an absolute version of `path`.| +|basename(path) -> string|Gives the basename of `path`. For the rules,| +|cd(dir)|Changes directory to `dir`| +|dir(path) -> string|Returns the directory part of `path`. For the rules, see Go's| +|glob(pattern) -> matches (table)|Glob all files and directories that match the pattern.| +|join(...) -> string|Takes paths and joins them together with the OS's| +|mkdir(name, recursive)|Makes a directory called `name`. If `recursive` is true, it will create its parent directories.| +|readdir(dir) -> {}|Returns a table of files in `dir`.| +|stat(path) -> {}|Returns a table of info about the `path`.| + +
+

+fs.abs(path) -> string + + + +

+ Gives an absolute version of `path`. #### Parameters This function has no parameters. +

+

+fs.basename(path) -> string + + + +

-### fs.basename(path) -> string Gives the basename of `path`. For the rules, see Go's filepath.Base #### Parameters This function has no parameters. +

+

+fs.cd(dir) + + + +

-### fs.cd(dir) Changes directory to `dir` #### Parameters This function has no parameters. +

+

+fs.dir(path) -> string + + + +

-### fs.dir(path) -> string Returns the directory part of `path`. For the rules, see Go's filepath.Dir #### Parameters This function has no parameters. +

+

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

-### fs.glob(pattern) -> matches (table) Glob all files and directories that match the pattern. For the rules, see Go's filepath.Glob #### Parameters This function has no parameters. +

+

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

-### fs.join(...) -> string Takes paths and joins them together with the OS's directory separator (forward or backward slash). #### Parameters This function has no parameters. +

+

+fs.mkdir(name, recursive) + + + +

-### fs.mkdir(name, recursive) Makes a directory called `name`. If `recursive` is true, it will create its parent directories. #### Parameters This function has no parameters. +

+

+fs.readdir(dir) -> {} + + + +

-### fs.readdir(dir) -> {} Returns a table of files in `dir`. #### Parameters This function has no parameters. +

+

+fs.stat(path) -> {} + + + +

-### fs.stat(path) -> {} Returns a table of info about the `path`. It contains the following keys: name (string) - Name of the path @@ -66,4 +133,4 @@ mode (string) - Permission mode in an octal format string (with leading 0) isDir (boolean) - If the path is a directory #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md index 9ebd21a..317ba5d 100644 --- a/docs/api/hilbish/_index.md +++ b/docs/api/hilbish/_index.md @@ -11,6 +11,28 @@ menu: The Hilbish module includes the core API, containing interfaces and functions which directly relate to shell functionality. +## Functions +||| +|----|----| +|alias(cmd, orig)|Sets an alias of `cmd` to `orig`| +|appendPath(dir)|Appends `dir` to $PATH| +|complete(scope, cb)|Registers a completion handler for `scope`.| +|cwd() -> string|Returns the current directory of the shell| +|exec(cmd)|Replaces running hilbish with `cmd`| +|goro(fn)|Puts `fn` in a goroutine| +|highlighter(line)|Line highlighter handler. This is mainly for syntax highlighting, but in| +|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. Accepts either emacs or vim| +|interval(cb, time) -> @Timer|Runs the `cb` function every `time` milliseconds.| +|multiprompt(str)|Changes the continued line prompt to `str`| +|prependPath(dir)|Prepends `dir` to $PATH| +|prompt(str, typ)|Changes the shell prompt to `str`| +|read(prompt) -> input (string)|Read input from the user, using Hilbish's line editor/input reader.| +|run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)|Runs `cmd` in Hilbish's sh interpreter.| +|runnerMode(mode)|Sets the execution/runner mode for interactive Hilbish. This determines whether| +|timeout(cb, time) -> @Timer|Runs the `cb` function after `time` in milliseconds.| +|which(name) -> string|Checks if `name` is a valid command.| + ## Interface fields - `ver`: The version of Hilbish - `goVersion`: The version of Go that Hilbish was compiled with @@ -22,18 +44,36 @@ 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`: xit code of the last executed command -## Functions -### hilbish.alias(cmd, orig) +
+

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

+ Sets an alias of `cmd` to `orig` #### Parameters This function has no parameters. +

+

+hilbish.appendPath(dir) + + + +

-### hilbish.appendPath(dir) Appends `dir` to $PATH #### Parameters This function has no parameters. +

+

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

-### hilbish.complete(scope, cb) Registers a completion handler for `scope`. A `scope` is currently only expected to be `command.`, replacing with the name of the command (for example `command.git`). @@ -41,23 +81,47 @@ replacing with the name of the command (for example `command.git`). Check `doc completions` for more information. #### Parameters This function has no parameters. +

+

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

-### hilbish.cwd() -> string Returns the current directory of the shell #### Parameters This function has no parameters. +

+

+hilbish.exec(cmd) + + + +

-### hilbish.exec(cmd) Replaces running hilbish with `cmd` #### Parameters This function has no parameters. +

+

+hilbish.goro(fn) + + + +

-### hilbish.goro(fn) Puts `fn` in a goroutine #### Parameters This function has no parameters. +

+

+hilbish.highlighter(line) + + + +

-### 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 @@ -72,8 +136,14 @@ end This code will highlight all double quoted strings in green. #### Parameters This function has no parameters. +

+

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

-### 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 @@ -81,29 +151,59 @@ as the text for the hint. This is by default a shim. To set hints, override this function with your custom handler. #### Parameters This function has no parameters. +

+

+hilbish.inputMode(mode) + + + +

-### hilbish.inputMode(mode) Sets the input mode for Hilbish's line reader. Accepts either emacs or vim #### Parameters This function has no parameters. +

+

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

-### hilbish.interval(cb, time) -> Timer Runs the `cb` function every `time` milliseconds. This creates a timer that starts immediately. #### Parameters This function has no parameters. +

+

+hilbish.multiprompt(str) + + + +

-### hilbish.multiprompt(str) Changes the continued line prompt to `str` #### Parameters This function has no parameters. +

+

+hilbish.prependPath(dir) + + + +

-### hilbish.prependPath(dir) Prepends `dir` to $PATH #### Parameters This function has no parameters. +

+

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

-### hilbish.prompt(str, typ) Changes the shell prompt to `str` There are a few verbs that can be used in the prompt text. These will be formatted and replaced with the appropriate values. @@ -112,22 +212,40 @@ These will be formatted and replaced with the appropriate values. `%h` - Hostname of device #### Parameters This function has no parameters. +

+

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

-### 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 (which shouldn't happen) #### Parameters This function has no parameters. +

+

+hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string) + + + +

-### hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string) Runs `cmd` in Hilbish's sh interpreter. If returnOut is true, the outputs of `cmd` will be returned as the 2nd and 3rd values instead of being outputted to the terminal. #### Parameters This function has no parameters. +

+

+hilbish.runnerMode(mode) + + + +

-### hilbish.runnerMode(mode) Sets the execution/runner mode for interactive Hilbish. 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), @@ -135,20 +253,31 @@ sh, and lua. It also accepts a function, to which if it is passed one will call it to execute user input instead. #### Parameters This function has no parameters. +

+

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

-### hilbish.timeout(cb, time) -> Timer Runs the `cb` function after `time` in milliseconds. This creates a timer that starts immediately. #### Parameters This function has no parameters. +

+

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

-### 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 This function has no parameters. - -## Types +





## Types ## Sink A sink is a structure that has input and/or output to/from a desination. diff --git a/docs/api/hilbish/hilbish.aliases.md b/docs/api/hilbish/hilbish.aliases.md index 1936b47..da6cd65 100644 --- a/docs/api/hilbish/hilbish.aliases.md +++ b/docs/api/hilbish/hilbish.aliases.md @@ -11,23 +11,55 @@ menu: The alias interface deals with all command aliases in Hilbish. ## Functions -### hilbish.aliases.add(alias, cmd) +||| +|----|----| +|add(alias, cmd)|This is an alias (ha) for the `hilbish.alias` function.| +|delete(name)|Removes an alias.| +|list() -> table|Get a table of all aliases, with string keys as the alias and the value as the command.| +|resolve(alias) -> command (string)|Tries to resolve an alias to its command.| + +
+

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

+ This is an alias (ha) for the `hilbish.alias` function. #### Parameters This function has no parameters. +

+

+hilbish.aliases.delete(name) + + + +

-### hilbish.aliases.delete(name) Removes an alias. #### Parameters This function has no parameters. +

+

+hilbish.aliases.list() -> table\ + + + +

-### hilbish.aliases.list() -> table\ Get a table of all aliases, with string keys as the alias and the value as the command. #### Parameters This function has no parameters. +

+

+hilbish.aliases.resolve(alias) -> command (string) + + + +

-### hilbish.aliases.resolve(alias) -> command (string) Tries to resolve an alias to its command. #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/hilbish.completions.md b/docs/api/hilbish/hilbish.completions.md index 6ec1206..726e7e9 100644 --- a/docs/api/hilbish/hilbish.completions.md +++ b/docs/api/hilbish/hilbish.completions.md @@ -11,27 +11,59 @@ menu: The completions interface deals with tab completions. ## Functions -### hilbish.completions.call(name, query, ctx, fields) -> completionGroups (table), prefix (string) +||| +|----|----| +|call(name, query, ctx, fields) -> completionGroups (table), prefix (string)|Calls a completer function. This is mainly used to call| +|handler(line, pos)|The handler function is the callback for tab completion in Hilbish.| +|bins(query, ctx, fields) -> entries (table), prefix (string)|Returns binary/executale completion candidates based on the provided query.| +|files(query, ctx, fields) -> entries (table), prefix (string)|Returns file completion candidates based on the provided query.| + +
+

+hilbish.completions.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 `doc completions` for info on the `completionGroups` return value. #### Parameters This function has no parameters. +

+

+hilbish.completions.handler(line, pos) + + + +

-### hilbish.completions.handler(line, pos) The handler function is the callback for tab completion in Hilbish. You can check the completions doc for more info. #### Parameters This function has no parameters. +

+

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

-### hilbish.completions.bins(query, ctx, fields) -> entries (table), prefix (string) Returns binary/executale completion candidates based on the provided query. #### Parameters This function has no parameters. +

+

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

-### hilbish.completions.files(query, ctx, fields) -> entries (table), prefix (string) Returns file completion candidates based on the provided query. #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/hilbish.editor.md b/docs/api/hilbish/hilbish.editor.md index e10aca9..38b247e 100644 --- a/docs/api/hilbish/hilbish.editor.md +++ b/docs/api/hilbish/hilbish.editor.md @@ -12,23 +12,55 @@ The hilbish.editor interface provides functions to directly interact with the line editor in use. ## Functions -### hilbish.editor.getLine() -> string +||| +|----|----| +|getLine() -> string|Returns the current input line.| +|getVimRegister(register) -> string|Returns the text that is at the register.| +|insert(text)|Inserts text into the line.| +|setVimRegister(register, text)|Sets the vim register at `register` to hold the passed text.| + +
+

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

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

+

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

-### hilbish.editor.getVimRegister(register) -> string Returns the text that is at the register. #### Parameters This function has no parameters. +

+

+hilbish.editor.insert(text) + + + +

-### hilbish.editor.insert(text) Inserts text into the line. #### Parameters This function has no parameters. +

+

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

-### hilbish.editor.setVimRegister(register, text) Sets the vim register at `register` to hold the passed text. #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/hilbish.history.md b/docs/api/hilbish/hilbish.history.md index 902155f..0f60370 100644 --- a/docs/api/hilbish/hilbish.history.md +++ b/docs/api/hilbish/hilbish.history.md @@ -13,28 +13,67 @@ This includes the ability to override functions to change the main method of saving history. ## Functions -### hilbish.history.add(cmd) +||| +|----|----| +|add(cmd)|Adds a command to the history.| +|all() -> table|Retrieves all history.| +|clear()|Deletes all commands from the history.| +|get(idx)|Retrieves a command from the history based on the `idx`.| +|size() -> number|Returns the amount of commands in the history.| + +
+

+hilbish.history.add(cmd) + + + +

+ Adds a command to the history. #### Parameters This function has no parameters. +

+

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

-### hilbish.history.all() -> table Retrieves all history. #### Parameters This function has no parameters. +

+

+hilbish.history.clear() + + + +

-### hilbish.history.clear() Deletes all commands from the history. #### Parameters This function has no parameters. +

+

+hilbish.history.get(idx) + + + +

-### hilbish.history.get(idx) Retrieves a command from the history based on the `idx`. #### Parameters This function has no parameters. +

+

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

-### hilbish.history.size() -> number Returns the amount of commands in the history. #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/hilbish.jobs.md b/docs/api/hilbish/hilbish.jobs.md index 5f8992d..f27bc98 100644 --- a/docs/api/hilbish/hilbish.jobs.md +++ b/docs/api/hilbish/hilbish.jobs.md @@ -15,32 +15,70 @@ 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 -### hilbish.jobs.add(cmdstr, args, execPath) +||| +|----|----| +|add(cmdstr, args, execPath)|Adds a new job to the job table. Note that this does not immediately run it.| +|all() -> table<@Job>|Returns a table of all job objects.| +|disown(id)|Disowns a job. This deletes it from the job table.| +|get(id) -> @Job|Get a job object via its ID.| +|last() -> @Job|Returns the last added job from the table.| + +




+

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

+ Adds a new job to the job table. Note that this does not immediately run it. #### Parameters This function has no parameters. +

+

+hilbish.jobs.all() -> table\<Job> + + + +

-### hilbish.jobs.all() -> table\<Job> Returns a table of all job objects. #### Parameters This function has no parameters. +

+

+hilbish.jobs.disown(id) + + + +

-### hilbish.jobs.disown(id) Disowns a job. This deletes it from the job table. #### Parameters This function has no parameters. +

+

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

-### hilbish.jobs.get(id) -> Job Get a job object via its ID. #### Parameters This function has no parameters. +

+

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

-### hilbish.jobs.last() -> Job Returns the last added job from the table. #### Parameters This function has no parameters. - -## Types +
## Types ## Job The Job type describes a Hilbish job. ### Properties diff --git a/docs/api/hilbish/hilbish.runner.md b/docs/api/hilbish/hilbish.runner.md index 7729bdd..f5977e1 100644 --- a/docs/api/hilbish/hilbish.runner.md +++ b/docs/api/hilbish/hilbish.runner.md @@ -15,23 +15,48 @@ language or script of their choosing. A good example is using it to write command in Fennel. ## Functions -### hilbish.runner.setMode(cb) +||| +|----|----| +|setMode(cb)|This is the same as the `hilbish.runnerMode` function. It takes a callback,| +|lua(cmd)|Evaluates `cmd` as Lua input. This is the same as using `dofile`| +|sh(cmd)|Runs a command in Hilbish's shell script interpreter.| + +
+

+hilbish.runner.setMode(cb) + + + +

+ This is the same as the `hilbish.runnerMode` function. It takes a callback, which will be used to execute all interactive input. In normal cases, neither callbacks should be overrided by the user, as the higher level functions listed below this will handle it. #### Parameters This function has no parameters. +

+

+hilbish.runner.lua(cmd) + + + +

-### 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 This function has no parameters. +

+

+hilbish.runner.sh(cmd) + + + +

-### hilbish.runner.sh(cmd) Runs a command in Hilbish's shell script interpreter. This is the equivalent of using `source`. #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/docs/api/hilbish/hilbish.timers.md b/docs/api/hilbish/hilbish.timers.md index 576c820..20efd7c 100644 --- a/docs/api/hilbish/hilbish.timers.md +++ b/docs/api/hilbish/hilbish.timers.md @@ -30,23 +30,40 @@ t:start() print(t.running) // true ``` +## Functions +||| +|----|----| +|create(type, time, callback) -> @Timer|Creates a timer that runs based on the specified `time` in milliseconds.| +|get(id) -> @Timer|Retrieves a timer via its ID.| + ## Interface fields - `INTERVAL`: Constant for an interval timer type - `TIMEOUT`: Constant for a timeout timer type -## Functions -### hilbish.timers.create(type, time, callback) -> Timer +


+

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

+ Creates a timer that runs based on the specified `time` in milliseconds. The `type` can either be `hilbish.timers.INTERVAL` or `hilbish.timers.TIMEOUT` #### Parameters This function has no parameters. +

+

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

-### hilbish.timers.get(id) -> Timer Retrieves a timer via its ID. #### Parameters This function has no parameters. - -## Types +
## Types ## Timer The Job type describes a Hilbish timer. ### Properties diff --git a/docs/api/terminal.md b/docs/api/terminal.md index 5ad24c7..5eed445 100644 --- a/docs/api/terminal.md +++ b/docs/api/terminal.md @@ -11,24 +11,56 @@ menu: The terminal library is a simple and lower level library for certain terminal interactions. ## Functions -### terminal.restoreState() +||| +|----|----| +|restoreState()|Restores the last saved state of the terminal| +|saveState()|Saves the current state of the terminal| +|setRaw()|Puts the terminal in raw mode| +|size()|Gets the dimensions of the terminal. Returns a table with `width` and `height`| + +
+

+terminal.restoreState() + + + +

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

+

+terminal.saveState() + + + +

-### terminal.saveState() Saves the current state of the terminal #### Parameters This function has no parameters. +

+

+terminal.setRaw() + + + +

-### terminal.setRaw() Puts the terminal in raw mode #### Parameters This function has no parameters. +

+

+terminal.size() + + + +

-### terminal.size() Gets the dimensions of the terminal. Returns a table with `width` and `height` Note: this is not the size in relation to the dimensions of the display #### Parameters This function has no parameters. - +
\ No newline at end of file diff --git a/emmyLuaDocs/bait.lua b/emmyLuaDocs/bait.lua index 35a37ed..6ca76ab 100644 --- a/emmyLuaDocs/bait.lua +++ b/emmyLuaDocs/bait.lua @@ -3,8 +3,6 @@ local bait = {} --- Catches a hook with `name`. Runs the `cb` when it is thrown ---- @param name string ---- @param cb function function bait.catch(name, cb) end --- Same as catch, but only runs the `cb` once and then removes the hook diff --git a/go.mod b/go.mod index c17d906..792d576 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.17 require ( github.com/arnodel/golua v0.0.0-20220221163911-dfcf252b6f86 + github.com/atsushinee/go-markdown-generator v0.0.0-20191121114853-83f9e1f68504 github.com/blackfireio/osinfo v1.0.3 github.com/chuckpreslar/emission v0.0.0-20170206194824-a7ddd980baf9 github.com/maxlandon/readline v0.1.0-beta.0.20211027085530-2b76cabb8036 diff --git a/go.sum b/go.sum index 1917008..d889ed3 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/arnodel/edit v0.0.0-20220202110212-dfc8d7a13890/go.mod h1:AcpttpuZBaL github.com/arnodel/strftime v0.1.6 h1:0hc0pUvk8KhEMXE+htyaOUV42zNcf/csIbjzEFCJqsw= github.com/arnodel/strftime v0.1.6/go.mod h1:5NbK5XqYK8QpRZpqKNt4OlxLtIB8cotkLk4KTKzJfWs= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/atsushinee/go-markdown-generator v0.0.0-20191121114853-83f9e1f68504 h1:R1/AOzdMbopSliUTTEHvHbyNmnZ3YxY5GvdhTkpPsSY= +github.com/atsushinee/go-markdown-generator v0.0.0-20191121114853-83f9e1f68504/go.mod h1:kHBCvAXJIatTX1pw6tLiOspjGc3MhUDRlog9yrCUS+k= github.com/blackfireio/osinfo v1.0.3 h1:Yk2t2GTPjBcESv6nDSWZKO87bGMQgO+Hi9OoXPpxX8c= github.com/blackfireio/osinfo v1.0.3/go.mod h1:Pd987poVNmd5Wsx6PRPw4+w7kLlf9iJxoRKPtPAjOrA= github.com/chuckpreslar/emission v0.0.0-20170206194824-a7ddd980baf9 h1:xz6Nv3zcwO2Lila35hcb0QloCQsc38Al13RNEzWRpX4= diff --git a/golibs/bait/bait.go b/golibs/bait/bait.go index 269ea1e..dca3773 100644 --- a/golibs/bait/bait.go +++ b/golibs/bait/bait.go @@ -12,7 +12,7 @@ You can act on events via callback functions. Examples of this are in the Hilbish default config! Consider this part of it: -``` +```lua bait.catch('command.exit', function(code) running = false doPrompt(code ~= 0) diff --git a/website/themes/hsh/layouts/partials/head.html b/website/themes/hsh/layouts/partials/head.html index cb2e12e..087d997 100644 --- a/website/themes/hsh/layouts/partials/head.html +++ b/website/themes/hsh/layouts/partials/head.html @@ -37,5 +37,37 @@ opacity: 1; transition: all .1s ease-in; } + + @keyframes highlight { + 0% { + background: none + } + 50% { + background: yellow; + } + 100% { + background: none; + } + } + + div:target { + animation: highlight 1s; + animation-timing-function: cubic-bezier(1,-0.02,.45,.89); + } + + table { + border-width: 1px; + border-style: solid; + border-color: #565c64;; + border-collapse: collapse; + } + + table td { + padding: 5px; + } + + table tr { + border-width: 1px; + }