Module: Bashly::Completions::Command

Included in:
Script::Command
Defined in:
lib/bashly/concerns/completions.rb

Instance Method Summary collapse

Instance Method Details

#completion_data(with_version: true) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bashly/concerns/completions.rb', line 21

def completion_data(with_version: true)
  result = {}

  completion_full_names.each do |name|
    name = "#{name}*" if name.include? '*'
    result[name] = completion_words with_version: with_version
    flags.each do |flag|
      result.merge! flag.completion_data(name)
    end
  end

  visible_commands.each do |command|
    result.merge! command.completion_data(with_version: false)
  end

  result
end

#completion_function(name = nil) ⇒ Object



43
44
45
# File 'lib/bashly/concerns/completions.rb', line 43

def completion_function(name = nil)
  completion_generator.wrapper_function name
end

#completion_scriptObject



39
40
41
# File 'lib/bashly/concerns/completions.rb', line 39

def completion_script
  completion_generator.script
end