docs: fully document aliases interface

docs-refactor
TorchedSammy 2022-12-05 19:11:52 -04:00
parent 525635787a
commit 9d5f6de064
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
3 changed files with 35 additions and 0 deletions

View File

@ -84,6 +84,13 @@ func (a *aliasModule) Loader(rtm *rt.Runtime) *rt.Table {
return mod return mod
} }
// #interface aliases
// add(alias, cmd)
// This is an alias (ha) for the `hilbish.alias` function.
// --- @param alias string
// --- @param cmd string
func _hlalias() {}
// #interface aliases // #interface aliases
// list() // list()
// Get a table of all aliases. // Get a table of all aliases.
@ -96,6 +103,10 @@ func (a *aliasModule) luaList(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return c.PushingNext1(t.Runtime, rt.TableValue(aliasesList)), nil return c.PushingNext1(t.Runtime, rt.TableValue(aliasesList)), nil
} }
// #interface aliases
// delete(name)
// Removes an alias.
// --- @param name string
func (a *aliasModule) luaDelete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { func (a *aliasModule) luaDelete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
if err := c.Check1Arg(); err != nil { if err := c.Check1Arg(); err != nil {
return nil, err return nil, err
@ -109,6 +120,10 @@ func (a *aliasModule) luaDelete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return c.Next(), nil return c.Next(), nil
} }
// #interface aliases
// resolve(alias)
// Tries to resolve an alias to its command.
// --- @param alias string
func (a *aliasModule) luaResolve(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { func (a *aliasModule) luaResolve(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
if err := c.Check1Arg(); err != nil { if err := c.Check1Arg(); err != nil {
return nil, err return nil, err

View File

@ -8,6 +8,15 @@ layout: apidoc
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)
This is an alias (ha) for the `hilbish.alias` function.
### delete(name)
Removes an alias.
### list() ### list()
Get a table of all aliases. Get a table of all aliases.
### resolve(alias)
Tries to resolve an alias to its command.

View File

@ -2,6 +2,9 @@
local hilbish = {} local hilbish = {}
--- This is an alias (ha) for the `hilbish.alias` function.
function hilbish.aliases.add(alias, cmd) end
--- Sets an alias of `cmd` to `orig` --- Sets an alias of `cmd` to `orig`
--- @param cmd string --- @param cmd string
--- @param orig string --- @param orig string
@ -111,7 +114,15 @@ function hilbish.which(name) end
--- Stops a timer. --- Stops a timer.
function hilbish.timers:stop() end function hilbish.timers:stop() end
--- Removes an alias.
--- @param name string
function hilbish.aliases.delete(name) end
--- Get a table of all aliases. --- Get a table of all aliases.
function hilbish.aliases.list() end function hilbish.aliases.list() end
--- Tries to resolve an alias to its command.
--- @param alias string
function hilbish.aliases.resolve(alias) end
return hilbish return hilbish