mirror of https://github.com/Hilbis/Hilbish
Merge 7c1984135b
into caff604d95
commit
e777848bbc
|
@ -43,6 +43,12 @@ type module struct {
|
||||||
HasTypes bool
|
HasTypes bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type param struct{
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Doc []string
|
||||||
|
}
|
||||||
|
|
||||||
type docPiece struct {
|
type docPiece struct {
|
||||||
Doc []string
|
Doc []string
|
||||||
FuncSig string
|
FuncSig string
|
||||||
|
@ -55,6 +61,7 @@ type docPiece struct {
|
||||||
IsType bool
|
IsType bool
|
||||||
Fields []docPiece
|
Fields []docPiece
|
||||||
Properties []docPiece
|
Properties []docPiece
|
||||||
|
Params []param
|
||||||
}
|
}
|
||||||
|
|
||||||
type tag struct {
|
type tag struct {
|
||||||
|
@ -215,6 +222,17 @@ start:
|
||||||
|
|
||||||
fields := docPieceTag("field", tags)
|
fields := docPieceTag("field", tags)
|
||||||
properties := docPieceTag("property", tags)
|
properties := docPieceTag("property", tags)
|
||||||
|
var params []param
|
||||||
|
if paramsRaw := tags["param"]; paramsRaw != nil {
|
||||||
|
params = make([]param, len(paramsRaw))
|
||||||
|
for i, p := range paramsRaw {
|
||||||
|
params[i] = param{
|
||||||
|
Name: p.id,
|
||||||
|
Type: p.fields[0],
|
||||||
|
Doc: p.fields[1:],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, d := range doc {
|
for _, d := range doc {
|
||||||
if strings.HasPrefix(d, "---") {
|
if strings.HasPrefix(d, "---") {
|
||||||
|
@ -252,6 +270,7 @@ start:
|
||||||
ParentModule: parentMod,
|
ParentModule: parentMod,
|
||||||
Fields: fields,
|
Fields: fields,
|
||||||
Properties: properties,
|
Properties: properties,
|
||||||
|
Params: params,
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(dps.GoFuncName, strings.ToLower("loader")) {
|
if strings.HasSuffix(dps.GoFuncName, strings.ToLower("loader")) {
|
||||||
dps.Doc = parts
|
dps.Doc = parts
|
||||||
|
@ -412,7 +431,7 @@ func main() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
modOrIface := "Module"
|
modOrIface := "Module"
|
||||||
if modu.ParentModule != "" {
|
if modu.ParentModule != "" {
|
||||||
modOrIface = "Interface"
|
modOrIface = "Module"
|
||||||
}
|
}
|
||||||
|
|
||||||
f, _ := os.Create(docPath)
|
f, _ := os.Create(docPath)
|
||||||
|
@ -454,7 +473,7 @@ func main() {
|
||||||
if dps.IsMember {
|
if dps.IsMember {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(dps.FuncSig, "<", `\<`, -1), func(typ string) string {
|
htmlSig := typeTag.ReplaceAllStringFunc(strings.Replace(modname + "." + dps.FuncSig, "<", `\<`, -1), func(typ string) string {
|
||||||
typName := typ[1:]
|
typName := typ[1:]
|
||||||
typLookup := typeTable[strings.ToLower(typName)]
|
typLookup := typeTable[strings.ToLower(typName)]
|
||||||
ifaces := typLookup[0] + "." + typLookup[1] + "/"
|
ifaces := typLookup[0] + "." + typLookup[1] + "/"
|
||||||
|
@ -462,7 +481,7 @@ func main() {
|
||||||
ifaces = ""
|
ifaces = ""
|
||||||
}
|
}
|
||||||
linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s#%s", typLookup[0], ifaces, strings.ToLower(typName))
|
linkedTyp := fmt.Sprintf("/Hilbish/docs/api/%s/%s#%s", typLookup[0], ifaces, strings.ToLower(typName))
|
||||||
return fmt.Sprintf(`<a href="%s" style="text-decoration: none;">%s</a>`, linkedTyp, typName)
|
return fmt.Sprintf(`<a href="%s" style="text-decoration: none;" id="lol">%s</a>`, linkedTyp, typName)
|
||||||
})
|
})
|
||||||
f.WriteString(fmt.Sprintf("### %s\n", htmlSig))
|
f.WriteString(fmt.Sprintf("### %s\n", htmlSig))
|
||||||
for _, doc := range dps.Doc {
|
for _, doc := range dps.Doc {
|
||||||
|
@ -470,6 +489,26 @@ func main() {
|
||||||
f.WriteString(doc + "\n")
|
f.WriteString(doc + "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
f.WriteString("#### Parameters\n")
|
||||||
|
if len(dps.Params) == 0 {
|
||||||
|
f.WriteString("This function has no parameters. \n")
|
||||||
|
}
|
||||||
|
for _, p := range dps.Params {
|
||||||
|
isVariadic := false
|
||||||
|
typ := p.Type
|
||||||
|
if strings.HasPrefix(p.Type, "...") {
|
||||||
|
isVariadic = true
|
||||||
|
typ = p.Type[3:]
|
||||||
|
}
|
||||||
|
|
||||||
|
f.WriteString(fmt.Sprintf("`%s` **`%s`**", typ, p.Name))
|
||||||
|
if isVariadic {
|
||||||
|
f.WriteString(" (This type is variadic. You can pass an infinite amount of parameters with this type.)")
|
||||||
|
}
|
||||||
|
f.WriteString(" \n")
|
||||||
|
f.WriteString(strings.Join(p.Doc, " "))
|
||||||
|
f.WriteString("\n\n")
|
||||||
|
}
|
||||||
f.WriteString("\n")
|
f.WriteString("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,20 +15,35 @@ happened, like when you've changed directory, a command has failed,
|
||||||
etc. To find all available hooks thrown by Hilbish, see doc hooks.
|
etc. To find all available hooks thrown by Hilbish, see doc hooks.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### catch(name, cb)
|
### bait.catch(name, cb)
|
||||||
Catches a hook with `name`. Runs the `cb` when it is thrown
|
Catches a hook with `name`. Runs the `cb` when it is thrown
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### catchOnce(name, cb)
|
### bait.catchOnce(name, cb)
|
||||||
Same as catch, but only runs the `cb` once and then removes the hook
|
Same as catch, but only runs the `cb` once and then removes the hook
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### hooks(name) -> table
|
### bait.hooks(name) -> table
|
||||||
Returns a table with hooks (callback functions) on the event with `name`.
|
Returns a table with hooks (callback functions) on the event with `name`.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### release(name, catcher)
|
### bait.release(name, catcher)
|
||||||
Removes the `catcher` for the event with `name`.
|
Removes the `catcher` for the event with `name`.
|
||||||
For this to work, `catcher` has to be the same function used to catch
|
For this to work, `catcher` has to be the same function used to catch
|
||||||
an event, like one saved to a variable.
|
an event, like one saved to a variable.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### throw(name, ...args)
|
### bait.throw(name, ...args)
|
||||||
Throws a hook with `name` with the provided `args`
|
Throws a hook with `name` with the provided `args`
|
||||||
|
#### Parameters
|
||||||
|
`string` **`name`**
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,13 @@ output should go.
|
||||||
name would suggest.
|
name would suggest.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### deregister(name)
|
### commander.deregister(name)
|
||||||
Deregisters any command registered with `name`
|
Deregisters any command registered with `name`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### register(name, cb)
|
### commander.register(name, cb)
|
||||||
Register a command with `name` that runs `cb` when ran
|
Register a command with `name` that runs `cb` when ran
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -13,39 +13,57 @@ and other things, and acts an addition to the Lua standard library's
|
||||||
I/O and filesystem functions.
|
I/O and filesystem functions.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### abs(path) -> string
|
### fs.abs(path) -> string
|
||||||
Gives an absolute version of `path`.
|
Gives an absolute version of `path`.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### basename(path) -> string
|
### fs.basename(path) -> string
|
||||||
Gives the basename of `path`. For the rules,
|
Gives the basename of `path`. For the rules,
|
||||||
see Go's filepath.Base
|
see Go's filepath.Base
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### cd(dir)
|
### fs.cd(dir)
|
||||||
Changes directory to `dir`
|
Changes directory to `dir`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### dir(path) -> string
|
### fs.dir(path) -> string
|
||||||
Returns the directory part of `path`. For the rules, see Go's
|
Returns the directory part of `path`. For the rules, see Go's
|
||||||
filepath.Dir
|
filepath.Dir
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### glob(pattern) -> matches (table)
|
### fs.glob(pattern) -> matches (table)
|
||||||
Glob all files and directories that match the pattern.
|
Glob all files and directories that match the pattern.
|
||||||
For the rules, see Go's filepath.Glob
|
For the rules, see Go's filepath.Glob
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### join(...) -> string
|
### fs.join(...) -> string
|
||||||
Takes paths and joins them together with the OS's
|
Takes paths and joins them together with the OS's
|
||||||
directory separator (forward or backward slash).
|
directory separator (forward or backward slash).
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### mkdir(name, recursive)
|
### fs.mkdir(name, recursive)
|
||||||
Makes a directory called `name`. If `recursive` is true, it will create its parent directories.
|
Makes a directory called `name`. If `recursive` is true, it will create its parent directories.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### readdir(dir) -> {}
|
### fs.readdir(dir) -> {}
|
||||||
Returns a table of files in `dir`.
|
Returns a table of files in `dir`.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### stat(path) -> {}
|
### fs.stat(path) -> {}
|
||||||
Returns a table of info about the `path`.
|
Returns a table of info about the `path`.
|
||||||
It contains the following keys:
|
It contains the following keys:
|
||||||
name (string) - Name of the path
|
name (string) - Name of the path
|
||||||
size (number) - Size of the path
|
size (number) - Size of the path
|
||||||
mode (string) - Permission mode in an octal format string (with leading 0)
|
mode (string) - Permission mode in an octal format string (with leading 0)
|
||||||
isDir (boolean) - If the path is a directory
|
isDir (boolean) - If the path is a directory
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -23,29 +23,41 @@ interfaces and functions which directly relate to shell functionality.
|
||||||
- `exitCode`: xit code of the last executed command
|
- `exitCode`: xit code of the last executed command
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### alias(cmd, orig)
|
### hilbish.alias(cmd, orig)
|
||||||
Sets an alias of `cmd` to `orig`
|
Sets an alias of `cmd` to `orig`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### appendPath(dir)
|
### hilbish.appendPath(dir)
|
||||||
Appends `dir` to $PATH
|
Appends `dir` to $PATH
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### complete(scope, cb)
|
### hilbish.complete(scope, cb)
|
||||||
Registers a completion handler for `scope`.
|
Registers a completion handler for `scope`.
|
||||||
A `scope` is currently only expected to be `command.<cmd>`,
|
A `scope` is currently only expected to be `command.<cmd>`,
|
||||||
replacing <cmd> with the name of the command (for example `command.git`).
|
replacing <cmd> with the name of the command (for example `command.git`).
|
||||||
`cb` must be a function that returns a table of "completion groups."
|
`cb` must be a function that returns a table of "completion groups."
|
||||||
Check `doc completions` for more information.
|
Check `doc completions` for more information.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### cwd() -> string
|
### hilbish.cwd() -> string
|
||||||
Returns the current directory of the shell
|
Returns the current directory of the shell
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### exec(cmd)
|
### hilbish.exec(cmd)
|
||||||
Replaces running hilbish with `cmd`
|
Replaces running hilbish with `cmd`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### goro(fn)
|
### hilbish.goro(fn)
|
||||||
Puts `fn` in a goroutine
|
Puts `fn` in a goroutine
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### highlighter(line)
|
### hilbish.highlighter(line)
|
||||||
Line highlighter handler. This is mainly for syntax highlighting, but in
|
Line highlighter handler. This is mainly for syntax highlighting, but in
|
||||||
reality could set the input of the prompt to *display* anything. The
|
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
|
callback is passed the current line and is expected to return a line that
|
||||||
|
@ -58,59 +70,83 @@ function hilbish.highlighter(line)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
This code will highlight all double quoted strings in green.
|
This code will highlight all double quoted strings in green.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### hinter(line, pos)
|
### hilbish.hinter(line, pos)
|
||||||
The command line hint handler. It gets called on every key insert to
|
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
|
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
|
line and cursor position. It is expected to return a string which is used
|
||||||
as the text for the hint. This is by default a shim. To set hints,
|
as the text for the hint. This is by default a shim. To set hints,
|
||||||
override this function with your custom handler.
|
override this function with your custom handler.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### inputMode(mode)
|
### hilbish.inputMode(mode)
|
||||||
Sets the input mode for Hilbish's line reader. Accepts either emacs or vim
|
Sets the input mode for Hilbish's line reader. Accepts either emacs or vim
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### interval(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;">Timer</a>
|
### hilbish.interval(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
|
||||||
Runs the `cb` function every `time` milliseconds.
|
Runs the `cb` function every `time` milliseconds.
|
||||||
This creates a timer that starts immediately.
|
This creates a timer that starts immediately.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### multiprompt(str)
|
### hilbish.multiprompt(str)
|
||||||
Changes the continued line prompt to `str`
|
Changes the continued line prompt to `str`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### prependPath(dir)
|
### hilbish.prependPath(dir)
|
||||||
Prepends `dir` to $PATH
|
Prepends `dir` to $PATH
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### prompt(str, typ)
|
### hilbish.prompt(str, typ)
|
||||||
Changes the shell prompt to `str`
|
Changes the shell prompt to `str`
|
||||||
There are a few verbs that can be used in the prompt text.
|
There are a few verbs that can be used in the prompt text.
|
||||||
These will be formatted and replaced with the appropriate values.
|
These will be formatted and replaced with the appropriate values.
|
||||||
`%d` - Current working directory
|
`%d` - Current working directory
|
||||||
`%u` - Name of current user
|
`%u` - Name of current user
|
||||||
`%h` - Hostname of device
|
`%h` - Hostname of device
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### read(prompt) -> input (string)
|
### hilbish.read(prompt) -> input (string)
|
||||||
Read input from the user, using Hilbish's line editor/input reader.
|
Read input from the user, using Hilbish's line editor/input reader.
|
||||||
This is a separate instance from the one Hilbish actually uses.
|
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)
|
Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which shouldn't happen)
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### 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.
|
Runs `cmd` in Hilbish's sh interpreter.
|
||||||
If returnOut is true, the outputs of `cmd` will be returned as the 2nd and
|
If returnOut is true, the outputs of `cmd` will be returned as the 2nd and
|
||||||
3rd values instead of being outputted to the terminal.
|
3rd values instead of being outputted to the terminal.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### runnerMode(mode)
|
### hilbish.runnerMode(mode)
|
||||||
Sets the execution/runner mode for interactive Hilbish. This determines whether
|
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.
|
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),
|
Accepted values for mode are hybrid (the default), hybridRev (sh first then Lua),
|
||||||
sh, and lua. It also accepts a function, to which if it is passed one
|
sh, and lua. It also accepts a function, to which if it is passed one
|
||||||
will call it to execute user input instead.
|
will call it to execute user input instead.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### timeout(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;">Timer</a>
|
### hilbish.timeout(cb, time) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
|
||||||
Runs the `cb` function after `time` in milliseconds.
|
Runs the `cb` function after `time` in milliseconds.
|
||||||
This creates a timer that starts immediately.
|
This creates a timer that starts immediately.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### which(name) -> string
|
### hilbish.which(name) -> string
|
||||||
Checks if `name` is a valid command.
|
Checks if `name` is a valid command.
|
||||||
Will return the path of the binary, or a basename if it's a commander.
|
Will return the path of the binary, or a basename if it's a commander.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
## Types
|
## Types
|
||||||
## Sink
|
## Sink
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.aliases
|
title: Module hilbish.aliases
|
||||||
description: command aliasing
|
description: command aliasing
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -11,15 +11,23 @@ menu:
|
||||||
The alias interface deals with all command aliases in Hilbish.
|
The alias interface deals with all command aliases in Hilbish.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### add(alias, cmd)
|
### hilbish.aliases.add(alias, cmd)
|
||||||
This is an alias (ha) for the `hilbish.alias` function.
|
This is an alias (ha) for the `hilbish.alias` function.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### delete(name)
|
### hilbish.aliases.delete(name)
|
||||||
Removes an alias.
|
Removes an alias.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### list() -> table\<string, string>
|
### hilbish.aliases.list() -> table\<string, string>
|
||||||
Get a table of all aliases, with string keys as the alias and the value as the command.
|
Get a table of all aliases, with string keys as the alias and the value as the command.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### resolve(alias) -> command (string)
|
### hilbish.aliases.resolve(alias) -> command (string)
|
||||||
Tries to resolve an alias to its command.
|
Tries to resolve an alias to its command.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.completions
|
title: Module hilbish.completions
|
||||||
description: tab completions
|
description: tab completions
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -11,19 +11,27 @@ menu:
|
||||||
The completions interface deals with tab completions.
|
The completions interface deals with tab completions.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### call(name, query, ctx, fields) -> completionGroups (table), prefix (string)
|
### hilbish.completions.call(name, query, ctx, fields) -> completionGroups (table), prefix (string)
|
||||||
Calls a completer function. This is mainly used to call
|
Calls a completer function. This is mainly used to call
|
||||||
a command completer, which will have a `name` in the form
|
a command completer, which will have a `name` in the form
|
||||||
of `command.name`, example: `command.git`.
|
of `command.name`, example: `command.git`.
|
||||||
You can check `doc completions` for info on the `completionGroups` return value.
|
You can check `doc completions` for info on the `completionGroups` return value.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### handler(line, pos)
|
### hilbish.completions.handler(line, pos)
|
||||||
The handler function is the callback for tab completion in Hilbish.
|
The handler function is the callback for tab completion in Hilbish.
|
||||||
You can check the completions doc for more info.
|
You can check the completions doc for more info.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### 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.
|
Returns binary/executale completion candidates based on the provided query.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### 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.
|
Returns file completion candidates based on the provided query.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.editor
|
title: Module hilbish.editor
|
||||||
description: interactions for Hilbish's line reader
|
description: interactions for Hilbish's line reader
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -12,15 +12,23 @@ The hilbish.editor interface provides functions to
|
||||||
directly interact with the line editor in use.
|
directly interact with the line editor in use.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### getLine() -> string
|
### hilbish.editor.getLine() -> string
|
||||||
Returns the current input line.
|
Returns the current input line.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### getVimRegister(register) -> string
|
### hilbish.editor.getVimRegister(register) -> string
|
||||||
Returns the text that is at the register.
|
Returns the text that is at the register.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### insert(text)
|
### hilbish.editor.insert(text)
|
||||||
Inserts text into the line.
|
Inserts text into the line.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### setVimRegister(register, text)
|
### hilbish.editor.setVimRegister(register, text)
|
||||||
Sets the vim register at `register` to hold the passed text.
|
Sets the vim register at `register` to hold the passed text.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.history
|
title: Module hilbish.history
|
||||||
description: command history
|
description: command history
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -13,18 +13,28 @@ This includes the ability to override functions to change the main
|
||||||
method of saving history.
|
method of saving history.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### add(cmd)
|
### hilbish.history.add(cmd)
|
||||||
Adds a command to the history.
|
Adds a command to the history.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### all() -> table
|
### hilbish.history.all() -> table
|
||||||
Retrieves all history.
|
Retrieves all history.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### clear()
|
### hilbish.history.clear()
|
||||||
Deletes all commands from the history.
|
Deletes all commands from the history.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### get(idx)
|
### hilbish.history.get(idx)
|
||||||
Retrieves a command from the history based on the `idx`.
|
Retrieves a command from the history based on the `idx`.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### size() -> number
|
### hilbish.history.size() -> number
|
||||||
Returns the amount of commands in the history.
|
Returns the amount of commands in the history.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.jobs
|
title: Module hilbish.jobs
|
||||||
description: background job management
|
description: background job management
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -15,20 +15,30 @@ 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.
|
interactive usage or with the functions defined below for use in external runners.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### add(cmdstr, args, execPath)
|
### hilbish.jobs.add(cmdstr, args, execPath)
|
||||||
Adds a new job to the job table. Note that this does not immediately run it.
|
Adds a new job to the job table. Note that this does not immediately run it.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### all() -> table\<<a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;">Job</a>>
|
### hilbish.jobs.all() -> table\<<a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>>
|
||||||
Returns a table of all job objects.
|
Returns a table of all job objects.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### disown(id)
|
### hilbish.jobs.disown(id)
|
||||||
Disowns a job. This deletes it from the job table.
|
Disowns a job. This deletes it from the job table.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;">Job</a>
|
### hilbish.jobs.get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>
|
||||||
Get a job object via its ID.
|
Get a job object via its ID.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### last() -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;">Job</a>
|
### hilbish.jobs.last() -> <a href="/Hilbish/docs/api/hilbish/hilbish.jobs/#job" style="text-decoration: none;" id="lol">Job</a>
|
||||||
Returns the last added job from the table.
|
Returns the last added job from the table.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
## Types
|
## Types
|
||||||
## Job
|
## Job
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.os
|
title: Module hilbish.os
|
||||||
description: OS Info
|
description: OS Info
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.runner
|
title: Module hilbish.runner
|
||||||
description: interactive command runner customization
|
description: interactive command runner customization
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -15,17 +15,23 @@ language or script of their choosing. A good example is using it to
|
||||||
write command in Fennel.
|
write command in Fennel.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### setMode(cb)
|
### hilbish.runner.setMode(cb)
|
||||||
This is the same as the `hilbish.runnerMode` function. It takes a callback,
|
This is the same as the `hilbish.runnerMode` function. It takes a callback,
|
||||||
which will be used to execute all interactive input.
|
which will be used to execute all interactive input.
|
||||||
In normal cases, neither callbacks should be overrided by the user,
|
In normal cases, neither callbacks should be overrided by the user,
|
||||||
as the higher level functions listed below this will handle it.
|
as the higher level functions listed below this will handle it.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### lua(cmd)
|
### hilbish.runner.lua(cmd)
|
||||||
Evaluates `cmd` as Lua input. This is the same as using `dofile`
|
Evaluates `cmd` as Lua input. This is the same as using `dofile`
|
||||||
or `load`, but is appropriated for the runner interface.
|
or `load`, but is appropriated for the runner interface.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### sh(cmd)
|
### hilbish.runner.sh(cmd)
|
||||||
Runs a command in Hilbish's shell script interpreter.
|
Runs a command in Hilbish's shell script interpreter.
|
||||||
This is the equivalent of using `source`.
|
This is the equivalent of using `source`.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.timers
|
title: Module hilbish.timers
|
||||||
description: timeout and interval API
|
description: timeout and interval API
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
@ -35,12 +35,16 @@ print(t.running) // true
|
||||||
- `TIMEOUT`: Constant for a timeout timer type
|
- `TIMEOUT`: Constant for a timeout timer type
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### create(type, time, callback) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;">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>
|
||||||
Creates a timer that runs based on the specified `time` in milliseconds.
|
Creates a timer that runs based on the specified `time` in milliseconds.
|
||||||
The `type` can either be `hilbish.timers.INTERVAL` or `hilbish.timers.TIMEOUT`
|
The `type` can either be `hilbish.timers.INTERVAL` or `hilbish.timers.TIMEOUT`
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;">Timer</a>
|
### hilbish.timers.get(id) -> <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" style="text-decoration: none;" id="lol">Timer</a>
|
||||||
Retrieves a timer via its ID.
|
Retrieves a timer via its ID.
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
## Types
|
## Types
|
||||||
## Timer
|
## Timer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Interface hilbish.userDir
|
title: Module hilbish.userDir
|
||||||
description: user-related directories
|
description: user-related directories
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
|
|
|
@ -11,16 +11,24 @@ menu:
|
||||||
The terminal library is a simple and lower level library for certain terminal interactions.
|
The terminal library is a simple and lower level library for certain terminal interactions.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### restoreState()
|
### terminal.restoreState()
|
||||||
Restores the last saved state of the terminal
|
Restores the last saved state of the terminal
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### saveState()
|
### terminal.saveState()
|
||||||
Saves the current state of the terminal
|
Saves the current state of the terminal
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### setRaw()
|
### terminal.setRaw()
|
||||||
Puts the terminal in raw mode
|
Puts the terminal in raw mode
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
### size()
|
### terminal.size()
|
||||||
Gets the dimensions of the terminal. Returns a table with `width` and `height`
|
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
|
Note: this is not the size in relation to the dimensions of the display
|
||||||
|
#### Parameters
|
||||||
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,8 @@ func handleHook(t *rt.Thread, c *rt.GoCont, name string, catcher *rt.Closure, ar
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw(name, ...args)
|
// throw(name, ...args)
|
||||||
|
// #param name string The name of the hook.
|
||||||
|
// #param args ...any The arguments to pass to the hook.
|
||||||
// Throws a hook with `name` with the provided `args`
|
// Throws a hook with `name` with the provided `args`
|
||||||
// --- @param name string
|
// --- @param name string
|
||||||
// --- @vararg any
|
// --- @vararg any
|
||||||
|
|
Loading…
Reference in New Issue