From 9d5f6de0646c1cc5d372e4c7ea10773cb801d87c Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Mon, 5 Dec 2022 19:11:52 -0400 Subject: [PATCH] docs: fully document aliases interface --- aliases.go | 15 +++++++++++++++ docs/api/hilbish/hilbish.aliases.md | 9 +++++++++ emmyLuaDocs/hilbish.lua | 11 +++++++++++ 3 files changed, 35 insertions(+) diff --git a/aliases.go b/aliases.go index 2ce5db0..741a6a3 100644 --- a/aliases.go +++ b/aliases.go @@ -84,6 +84,13 @@ func (a *aliasModule) Loader(rtm *rt.Runtime) *rt.Table { 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 // list() // 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 } +// #interface aliases +// delete(name) +// Removes an alias. +// --- @param name string func (a *aliasModule) luaDelete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { if err := c.Check1Arg(); err != nil { return nil, err @@ -109,6 +120,10 @@ func (a *aliasModule) luaDelete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { 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) { if err := c.Check1Arg(); err != nil { return nil, err diff --git a/docs/api/hilbish/hilbish.aliases.md b/docs/api/hilbish/hilbish.aliases.md index b604860..3c31113 100644 --- a/docs/api/hilbish/hilbish.aliases.md +++ b/docs/api/hilbish/hilbish.aliases.md @@ -8,6 +8,15 @@ layout: apidoc The alias interface deals with all command aliases in Hilbish. ## Functions +### add(alias, cmd) +This is an alias (ha) for the `hilbish.alias` function. + +### delete(name) +Removes an alias. + ### list() Get a table of all aliases. +### resolve(alias) +Tries to resolve an alias to its command. + diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua index 7f39709..fdd7b38 100644 --- a/emmyLuaDocs/hilbish.lua +++ b/emmyLuaDocs/hilbish.lua @@ -2,6 +2,9 @@ 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` --- @param cmd string --- @param orig string @@ -111,7 +114,15 @@ function hilbish.which(name) end --- Stops a timer. function hilbish.timers:stop() end +--- Removes an alias. +--- @param name string +function hilbish.aliases.delete(name) end + --- Get a table of all aliases. function hilbish.aliases.list() end +--- Tries to resolve an alias to its command. +--- @param alias string +function hilbish.aliases.resolve(alias) end + return hilbish