Class: Lightning

Inherits:
Object
  • Object
show all
Extended by:
Config
Defined in:
lib/lightning/bolt.rb,
lib/lightning.rb,
lib/lightning/bolts.rb,
lib/lightning/generator.rb,
lib/lightning/completion.rb,
lib/lightning/completion_map.rb

Overview

This class maps completions to their full paths for the given blobs

Defined Under Namespace

Modules: Config Classes: Bolt, Bolts, Completion, CompletionMap, Generator

Constant Summary collapse

TEST_FLAG =
'-test'

Class Attribute Summary collapse

Attributes included from Config

#config_file

Class Method Summary collapse

Methods included from Config

commands_to_bolt_key, config, config=, config_command, configure_commands_and_paths, ignore_paths, load_config, read_config_file, setup_config

Class Attribute Details

.current_commandObject

Returns the value of attribute current_command.



15
16
17
# File 'lib/lightning.rb', line 15

def current_command
  @current_command
end

Class Method Details

.boltsObject



36
37
38
# File 'lib/lightning.rb', line 36

def bolts
  @bolts ||= Bolts.new
end

.complete(command, text_to_complete) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/lightning.rb', line 16

def complete(command, text_to_complete)
  load_config
  @current_command = command
  if bolt_key = config_command(command)['bolt_key']
    Completion.complete(text_to_complete, bolt_key)
  else
    ["Error: No paths found for this command.", "If this is a bug contact me."]
  end
end

.translate(command, argv) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/lightning.rb', line 26

def translate(command, argv)
  load_config
  @current_command = command
  if bolt_key = config_command(command)['bolt_key']
    bolts[bolt_key].resolve_completion(argv)
  else
    'Error-no_paths_found_for_this_command'
  end
end