mirror of https://github.com/Hilbis/Hilbish
docs: fully document aliases interface
parent
525635787a
commit
9d5f6de064
15
aliases.go
15
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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue