mirror of https://github.com/Hilbis/Hilbish
Compare commits
4 Commits
e38d5616aa
...
4e3d2f8f86
Author | SHA1 | Date |
---|---|---|
sammyette | 4e3d2f8f86 | |
sammyette | a0513c0a05 | |
sammyette | 1d64a57e24 | |
TorchedSammy | 1a4585aa7a |
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
title: Interface hilbish.completion
|
||||||
|
description: tab completions
|
||||||
|
layout: doc
|
||||||
|
menu:
|
||||||
|
docs:
|
||||||
|
parent: "API"
|
||||||
|
---
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
The completions interface deals with tab completions.
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
### call(name, query, ctx, fields) -> completionGroups (table), prefix (string)
|
||||||
|
Calls a completer function. This is mainly used to call
|
||||||
|
a command completer, which will have a `name` in the form
|
||||||
|
of `command.name`, example: `command.git`.
|
||||||
|
You can check `doc completions` for info on the `completionGroups` return value.
|
||||||
|
|
||||||
|
### handler(line, pos)
|
||||||
|
The handler function is the callback for tab completion in Hilbish.
|
||||||
|
You can check the completions doc for more info.
|
||||||
|
|
||||||
|
### bins(query, ctx, fields) -> entries (table), prefix (string)
|
||||||
|
Returns binary/executale completion candidates based on the provided query.
|
||||||
|
|
||||||
|
### files(query, ctx, fields) -> entries (table), prefix (string)
|
||||||
|
Returns file completion candidates based on the provided query.
|
||||||
|
|
|
@ -22,13 +22,13 @@ function hilbish.runner.setMode(cb) end
|
||||||
--- @param query string
|
--- @param query string
|
||||||
--- @param ctx string
|
--- @param ctx string
|
||||||
--- @param fields table
|
--- @param fields table
|
||||||
function hilbish.completions.call(name, query, ctx, fields) end
|
function hilbish.completion.call(name, query, ctx, fields) end
|
||||||
|
|
||||||
--- 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.
|
||||||
--- @param line string
|
--- @param line string
|
||||||
--- @param pos string
|
--- @param pos string
|
||||||
function hilbish.completions.handler(line, pos) end
|
function hilbish.completion.handler(line, pos) end
|
||||||
|
|
||||||
--- Returns the current input line.
|
--- Returns the current input line.
|
||||||
function hilbish.editor.getLine() end
|
function hilbish.editor.getLine() end
|
||||||
|
@ -175,13 +175,13 @@ function hilbish.jobs:background() end
|
||||||
--- @param query string
|
--- @param query string
|
||||||
--- @param ctx string
|
--- @param ctx string
|
||||||
--- @param fields table
|
--- @param fields table
|
||||||
function hilbish.completions.bins(query, ctx, fields) end
|
function hilbish.completion.bins(query, ctx, fields) end
|
||||||
|
|
||||||
--- Returns file completion candidates based on the provided query.
|
--- Returns file completion candidates based on the provided query.
|
||||||
--- @param query string
|
--- @param query string
|
||||||
--- @param ctx string
|
--- @param ctx string
|
||||||
--- @param fields table
|
--- @param fields table
|
||||||
function hilbish.completions.files(query, ctx, fields) end
|
function hilbish.completion.files(query, ctx, fields) end
|
||||||
|
|
||||||
--- Puts a job in the foreground. This will cause it to run like it was
|
--- Puts a job in the foreground. This will cause it to run like it was
|
||||||
--- executed normally and wait for it to complete.
|
--- executed normally and wait for it to complete.
|
||||||
|
|
3
exec.go
3
exec.go
|
@ -175,6 +175,9 @@ func runLuaRunner(runr rt.Value, userInput string) (input string, exitCode uint8
|
||||||
runnerRet := term.Get(0)
|
runnerRet := term.Get(0)
|
||||||
if runner, ok = runnerRet.TryTable(); !ok {
|
if runner, ok = runnerRet.TryTable(); !ok {
|
||||||
fmt.Fprintln(os.Stderr, "runner did not return a table")
|
fmt.Fprintln(os.Stderr, "runner did not return a table")
|
||||||
|
exitCode = 125
|
||||||
|
input = userInput
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if code, ok := runner.Get(rt.StringValue("exitCode")).TryInt(); ok {
|
if code, ok := runner.Get(rt.StringValue("exitCode")).TryInt(); ok {
|
||||||
|
|
Loading…
Reference in New Issue