fix: correction to completion documentation

i added an s even though there's no s.
to account for others making the same mistake, i added both.
hilbish.completion and hilbish.completions will work, but
hilbish.completion without s will be removed at a major update.
sudo-completion
sammyette 2023-12-02 11:11:28 -04:00
parent 29e14c1aee
commit 60fd4c3b4c
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 7 additions and 5 deletions

2
api.go
View File

@ -140,7 +140,9 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
// hilbish.completion table // hilbish.completion table
hshcomp := completionLoader(rtm) hshcomp := completionLoader(rtm)
// TODO: REMOVE "completion" AND ONLY USE "completions" WITH AN S
mod.Set(rt.StringValue("completion"), rt.TableValue(hshcomp)) mod.Set(rt.StringValue("completion"), rt.TableValue(hshcomp))
mod.Set(rt.StringValue("completions"), rt.TableValue(hshcomp))
// hilbish.runner table // hilbish.runner table
runnerModule := runnerModeLoader(rtm) runnerModule := runnerModeLoader(rtm)

View File

@ -188,7 +188,7 @@ func escapeFilename(fname string) string {
return escapeReplaer.Replace(fname) return escapeReplaer.Replace(fname)
} }
// #interface completions // #interface completion
// tab completions // tab completions
// The completions interface deals with tab completions. // The completions interface deals with tab completions.
func completionLoader(rtm *rt.Runtime) *rt.Table { func completionLoader(rtm *rt.Runtime) *rt.Table {
@ -205,7 +205,7 @@ func completionLoader(rtm *rt.Runtime) *rt.Table {
return mod return mod
} }
// #interface completions // #interface completion
// handler(line, pos) // 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.
@ -215,7 +215,7 @@ func completionHandler(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return c.Next(), nil return c.Next(), nil
} }
// #interface completions // #interface completion
// 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 // 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
@ -265,7 +265,7 @@ func callLuaCompleter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return cont, nil return cont, nil
} }
// #interface completions // #interface completion
// files(query, ctx, fields) -> entries (table), prefix (string) // 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.
// --- @param query string // --- @param query string
@ -287,7 +287,7 @@ func luaFileComplete(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return c.PushingNext(t.Runtime, rt.TableValue(luaComps), rt.StringValue(pfx)), nil return c.PushingNext(t.Runtime, rt.TableValue(luaComps), rt.StringValue(pfx)), nil
} }
// #interface completions // #interface completion
// bins(query, ctx, fields) -> entries (table), prefix (string) // 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.
// --- @param query string // --- @param query string