module Linenoise::Completion

Overview

A high-level wrapper around the linenoise completions API that makes it easier to add completions to your program.

Note: By default completions that start with the current line are shown in alphabetical order.

Defined in:

linenoise/completion.cr

Class Method Summary

Class Method Detail

def self.add(completion : String) #

Add a new completion string.

Note: This sets a completion callback internally.


[View source]
def self.add(completions : Array(String)) #

Add a batch of new completions.

Note: This sets a completion callback internally.


[View source]
def self.completion_matches(line : String) : Array(String) #

Finds completion matches that begin with the given line. The results are sorted alphabetically by default. The results are sorted by size if prefer shorter matches is set.

Note: This is made public for testing purposes but doesn't need to be called directly.


[View source]
def self.enable_hints!(color : Colorize::ColorANSI | Nil = nil) #

Enables hints that match the tab completions. Hints are shown in dark grey lettering by default to differentiate them from the characters that the user has already typed.

Note: This sets a hints callback internally.


[View source]
def self.prefer_shorter_matches! #

Completions will be sorted by size instead of alphabetically.


[View source]
def self.remove(completion : String) #

Remove a completion.


[View source]
def self.reset! #

Resets the completions array, whether shorter matches are preffered, hint color, and the callbacks. Mostly just needed for testing.


[View source]