class

Enkaidu::CLI::QueryReader

Inherits Reply::Reader < Reference < Object

Command-line query reader with editing and other capabilities.

Constants

DELIMETERS = {{ " \n\t'\"=".chars }}
PATH_DOC = "`Tab` / `Shift-Tab` select choices. `Esc` + `Tab` to restart auto-completion within a sub-folder."

Constructors

new(runtime : Enkaidu::Runtime, styler : Enkaidu::Console::StyleApplicator, input_history_file : String | Nil = nil)
Source

Instance methods

auto_complete(current_word : String, expression_before : String)

Override to integrate auto-completion.

current_word is picked following word_delimiters. It expects to return Tuple with:

  • a title : String
  • the auto-completion results : Array(String)

default: {"", [] of String}

Source
documentation(entry : String)

Override to set the entire documentation for an autocompletion entry.

If not nil, the documentation is shown in its own alternate screen when alt-d is pressed.

default: nil

Source
format(expression : String) : String | Nil

Remove trailing whitespace

Source
highlight(expression : String) : String

Highlight the expression

Source
history_file

Override to indicate the Path|String|IO where the history is saved. If nil, the history is not persistent.

default: nil

Source
prefix
Source
prefix=(prefix : String)
Source
prompt(io : IO, line_number : Int32, color : Bool) : Nil

Override to customize the prompt.

Toggle the colorization following color.

default: $:001>

Source
save_in_history?(expression : String) : Bool

Override to select which expression is saved in history.

default: !expression.blank?

Source

Macros

cached_doc(name, doc_generator)

Macro, because we don't want the doc generator to execute before we check the cache

Source