lib/lightning/completion.rb in cldwalker-lightning-0.1.1 vs lib/lightning/completion.rb in cldwalker-lightning-0.1.2

- old
+ new

@@ -1,16 +1,16 @@ # derived from http://github.com/ryanb/dotfiles/tree/master/bash/completion_scripts/project_completion #This class handles completions given a path key and the text already typed. class Lightning class Completion - def self.complete(text_to_complete, path_key) - new(text_to_complete, path_key).matches + def self.complete(text_to_complete, bolt_key) + new(text_to_complete, bolt_key).matches end - def initialize(text_typed, path_key) + def initialize(text_typed, bolt_key) @text_typed = text_typed - @path_key = path_key + @bolt_key = bolt_key end def matches possible_completions.select do |e| e[0, typed.length] == typed @@ -22,9 +22,9 @@ text = @text_typed[/^(\S+)\s+(#{Lightning::TEST_FLAG})?\s*(.+?)$/, 3] || '' text.strip end def possible_completions - Lightning.path_map.completions(@path_key) + Lightning.bolts[@bolt_key].completions end end -end \ No newline at end of file +end