Class: VER::Executor::ExCommandT

Inherits:
Entry
  • Object
show all
Defined in:
lib/command_t/ex/command_t.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject



8
9
10
# File 'lib/command_t/ex/command_t.rb', line 8

def options
  @options || {}
end

#pwdObject



3
4
5
# File 'lib/command_t/ex/command_t.rb', line 3

def pwd
  @pwd || Dir.pwd
end

Instance Method Details

#action(selected) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/command_t/ex/command_t.rb', line 21

def action(selected)
  if selected
    throw :invalid if File.directory? selected
    VER.find_or_create_buffer(selected)
  else
    tree.children.each do |child|
      path = Array(child).first # if more is added later
      next if File.directory? path
      VER.find_or_create_buffer path
    end
  end
  callback.destroy(false)
end

#choices(text) ⇒ Object



17
18
19
# File 'lib/command_t/ex/command_t.rb', line 17

def choices(text)
  finder.sorted_matches_for(text, options)
end

#finderObject



13
14
15
# File 'lib/command_t/ex/command_t.rb', line 13

def finder
  @finder ||= CommandT::Finder.new(pwd, options)
end