diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.completion/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.completion/index.html index 985a8da..6ecdbf5 100644 --- a/versions/doc-improvements/docs/api/hilbish/hilbish.completion/index.html +++ b/versions/doc-improvements/docs/api/hilbish/hilbish.completion/index.html @@ -3,25 +3,10 @@

Module hilbish.completion

tab completions

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
handler(line, pos)This function contains the general completion handler for Hilbish. This function handles
bins(query, ctx, fields) -> entries (table), prefix (string)Return binaries/executables based on the provided parameters.
files(query, ctx, fields) -> entries (table), prefix (string)Returns file matches based on the provided parameters.

hilbish.completion.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 the Completions doc or doc completions for info on the completionGroups return value.

Parameters -

string name

string query

string ctx

table fields


hilbish.completion.handler(line, pos) -

This function contains the general completion handler for Hilbish. This function handles
completion of everything, which includes calling other command handlers, binaries, and files.
This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function.

Parameters -

string line
The current Hilbish command line

number pos
Numerical position of the cursor

Example -
 1-- stripped down version of the default implementation
- 2function hilbish.completion.handler(line, pos)
- 3	local query = fields[#fields]
- 4
- 5	if #fields == 1 then
- 6		-- call bins handler here
- 7	else
- 8		-- call command completer or files completer here
- 9	end
-10end
-

hilbish.completion.bins(query, ctx, fields) -> entries (table), prefix (string) -

Return binaries/executables based on the provided parameters.
This function is meant to be used as a helper in a command completion handler.

Parameters -

string query

string ctx

table fields

Example -
 1-- an extremely simple completer for sudo.
+
bins(query, ctx, fields) -> entries (table), prefix (string)Return binaries/executables based on the provided parameters.
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
files(query, ctx, fields) -> entries (table), prefix (string)Returns file matches based on the provided parameters.
handler(line, pos)This function contains the general completion handler for Hilbish. This function handles

hilbish.completion.bins(query, ctx, fields) -> entries (table), prefix (string) +

Return binaries/executables based on the provided parameters.
This function is meant to be used as a helper in a command completion handler.

Parameters +

string query

string ctx

table fields

Example +
 1-- an extremely simple completer for sudo.
  2hilbish.complete('command.sudo', function(query, ctx, fields)
  3	table.remove(fields, 1)
  4	if #fields[1] then
@@ -36,6 +21,21 @@
 13
 14	-- ... else suggest files or anything else ..
 15end)
-

hilbish.completion.files(query, ctx, fields) -> entries (table), prefix (string) -

Returns file matches based on the provided parameters.
This function is meant to be used as a helper in a command completion handler.

Parameters -

string query

string ctx

table fields

\ No newline at end of file +

hilbish.completion.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 the Completions doc or doc completions for info on the completionGroups return value.

Parameters +

string name

string query

string ctx

table fields


hilbish.completion.files(query, ctx, fields) -> entries (table), prefix (string) +

Returns file matches based on the provided parameters.
This function is meant to be used as a helper in a command completion handler.

Parameters +

string query

string ctx

table fields


hilbish.completion.handler(line, pos) +

This function contains the general completion handler for Hilbish. This function handles
completion of everything, which includes calling other command handlers, binaries, and files.
This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function.

Parameters +

string line
The current Hilbish command line

number pos
Numerical position of the cursor

Example +
 1-- stripped down version of the default implementation
+ 2function hilbish.completion.handler(line, pos)
+ 3	local query = fields[#fields]
+ 4
+ 5	if #fields == 1 then
+ 6		-- call bins handler here
+ 7	else
+ 8		-- call command completer or files completer here
+ 9	end
+10end
+
\ No newline at end of file diff --git a/versions/doc-improvements/docs/api/hilbish/index.xml b/versions/doc-improvements/docs/api/hilbish/index.xml index e1c50fc..9ea6529 100644 --- a/versions/doc-improvements/docs/api/hilbish/index.xml +++ b/versions/doc-improvements/docs/api/hilbish/index.xml @@ -1,6 +1,6 @@ Module hilbish on Hilbishhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/Recent content in Module hilbish on HilbishHugo -- gohugo.ioen-usModule hilbish.aliaseshttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/Introduction 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() -> table<string, string> Get a table of all aliases, with string keys as the alias and the value as the command. resolve(alias) -> command (string) Tries to resolve an alias to its command. hilbish.aliases.add(alias, cmd) This is an alias (ha) for the hilbish.Module hilbish.completionhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completion/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completion/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 handler(line, pos) This function contains the general completion handler for Hilbish. This function handles bins(query, ctx, fields) -> entries (table), prefix (string) Return binaries/executables based on the provided parameters. files(query, ctx, fields) -> entries (table), prefix (string) Returns file matches based on the provided parameters.Module hilbish.editorhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Introduction The hilbish.editor interface provides functions to directly interact with the line editor in use. +Functions bins(query, ctx, fields) -> entries (table), prefix (string) Return binaries/executables based on the provided parameters. 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 files(query, ctx, fields) -> entries (table), prefix (string) Returns file matches based on the provided parameters. handler(line, pos) This function contains the general completion handler for Hilbish.Module hilbish.editorhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Introduction The hilbish.editor interface provides functions to directly interact with the line editor in use. Functions getLine() -> string Returns the current input line. getVimRegister(register) -> string Returns the text that is at the register. insert(text) Inserts text into the line. getChar() -> string Reads a keystroke from the user. This is in a format setVimRegister(register, text) Sets the vim register at register to hold the passed text. hilbish.editor.getLine() -> string Returns the current input line.Module hilbish.historyhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/Introduction The history interface deals with command history. This includes the ability to override functions to change the main method of saving history. Functions add(cmd) Adds a command to the history. all() -> table Retrieves all history. clear() Deletes all commands from the history. get(idx) Retrieves a command from the history based on the idx. size() -> number Returns the amount of commands in the history. hilbish.history.add(cmd) Adds a command to the history.Module hilbish.jobshttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/Introduction Manage interactive jobs in Hilbish via Lua. Jobs are the name of background tasks/commands. A job can be started via interactive usage or with the functions defined below for use in external runners. diff --git a/versions/doc-improvements/index.xml b/versions/doc-improvements/index.xml index 88b927c..552d12e 100644 --- a/versions/doc-improvements/index.xml +++ b/versions/doc-improvements/index.xml @@ -35,7 +35,7 @@ Usage of the Bait module consists of userstanding event-driven architecture, but 1local commander = require 'commander' 2 3commander.register('hello', function(args, sinks) 4 sinks.out:writeln 'Hello world!' 5end) In this example, a command with the name of hello is created that will print Hello world!Module fshttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/Introduction The fs module provides filesystem functions to Hilbish. While Lua’s standard library has some I/O functions, they’re missing a lot of the basics. The fs library offers more functions and will work on any operating system Hilbish does. Functions abs(path) -> string Returns an absolute version of the path. basename(path) -> string Returns the “basename,” or the last part of the provided path. If path is empty, cd(dir) Changes Hilbish’s directory to dir.Module hilbish.aliaseshttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/Introduction 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() -> table<string, string> Get a table of all aliases, with string keys as the alias and the value as the command. resolve(alias) -> command (string) Tries to resolve an alias to its command. hilbish.aliases.add(alias, cmd) This is an alias (ha) for the hilbish.Module hilbish.completionhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completion/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completion/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 handler(line, pos) This function contains the general completion handler for Hilbish. This function handles bins(query, ctx, fields) -> entries (table), prefix (string) Return binaries/executables based on the provided parameters. files(query, ctx, fields) -> entries (table), prefix (string) Returns file matches based on the provided parameters.Module hilbish.editorhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Introduction The hilbish.editor interface provides functions to directly interact with the line editor in use. +Functions bins(query, ctx, fields) -> entries (table), prefix (string) Return binaries/executables based on the provided parameters. 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 files(query, ctx, fields) -> entries (table), prefix (string) Returns file matches based on the provided parameters. handler(line, pos) This function contains the general completion handler for Hilbish.Module hilbish.editorhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/Introduction The hilbish.editor interface provides functions to directly interact with the line editor in use. Functions getLine() -> string Returns the current input line. getVimRegister(register) -> string Returns the text that is at the register. insert(text) Inserts text into the line. getChar() -> string Reads a keystroke from the user. This is in a format setVimRegister(register, text) Sets the vim register at register to hold the passed text. hilbish.editor.getLine() -> string Returns the current input line.Module hilbish.historyhttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/Introduction The history interface deals with command history. This includes the ability to override functions to change the main method of saving history. Functions add(cmd) Adds a command to the history. all() -> table Retrieves all history. clear() Deletes all commands from the history. get(idx) Retrieves a command from the history based on the idx. size() -> number Returns the amount of commands in the history. hilbish.history.add(cmd) Adds a command to the history.Module hilbish.jobshttps://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/Introduction Manage interactive jobs in Hilbish via Lua. Jobs are the name of background tasks/commands. A job can be started via interactive usage or with the functions defined below for use in external runners.