Class: Toys::Utils::CompletionEngine::Base

Inherits:
Object
  • Object
show all
Defined in:
core-docs/toys/utils/completion_engine.rb

Overview

Defined in the toys-core gem

Base class for shell completion engines that use a COMP_LINE / COMP_POINT protocol.

Subclasses must implement the private methods #shell_name and #output_completions.

Direct Known Subclasses

Bash, Zsh

Instance Method Summary collapse

Constructor Details

#initialize(cli) ⇒ Base

Create a completion engine.

Parameters:



27
28
29
# File 'core-docs/toys/utils/completion_engine.rb', line 27

def initialize(cli)
  # Source available in the toys-core gem
end

Instance Method Details

#runInteger

Perform completion in the current shell environment, which must include settings for the COMP_LINE and COMP_POINT environment variables. Prints out completion candidates and returns a status code indicating the result.

  • 0 for success.
  • 1 if completion failed.
  • 2 if the environment is incorrect (e.g. expected environment variables not found)

Returns:

  • (Integer)

    status code



44
45
46
# File 'core-docs/toys/utils/completion_engine.rb', line 44

def run
  # Source available in the toys-core gem
end