Sha256: 533e8c5860a82a192e035f87523bac24f8c1155bdfaaf96846257dfa95adf165

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__))
require 'yaml'
require 'lightning/bolt'
require 'lightning/bolts'
require 'lightning/completion'
require 'lightning/config'
require 'lightning/path_map'
require 'lightning/core_extensions'
require 'lightning/generator'

class Lightning
  TEST_FLAG = '-test'
  extend Config
  class<<self
    attr_accessor :current_command
    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
    
    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
    
    def bolts
      @bolts ||= Bolts.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cldwalker-lightning-0.1.2 lib/lightning.rb