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.crClass Method Summary
-
.add(completion : String)
Add a new completion string.
-
.add(completions : Array(String))
Add a batch of new completions.
-
.completion_matches(line : String) : Array(String)
Finds completion matches that begin with the given line.
-
.enable_hints!(color : Colorize::ColorANSI | Nil = nil)
Enables hints that match the tab completions.
-
.prefer_shorter_matches!
Completions will be sorted by size instead of alphabetically.
-
.remove(completion : String)
Remove a completion.
-
.reset!
Resets the completions array, whether shorter matches are preffered, hint color, and the callbacks.
Class Method Detail
Add a new completion string.
Note: This sets a completion callback internally.
Add a batch of new completions.
Note: This sets a completion callback internally.
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.
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.
Resets the completions array, whether shorter matches are preffered, hint color, and the callbacks. Mostly just needed for testing.