class Bosh::Cli::Command::Complete

Public Instance Methods

complete(*args) click to toggle source
# File lib/cli/commands/complete.rb, line 9
def complete(*args)
  unless ENV.has_key?("COMP_LINE")
    err("COMP_LINE must be set when calling bosh complete")
  end
  line = ENV["COMP_LINE"].gsub(/^\S*bosh\s*/, "")
  say(completions(line).join("\n"))
end

Private Instance Methods

completions(line) click to toggle source

@param [String] line

# File lib/cli/commands/complete.rb, line 20
def completions(line)
  if runner.nil?
    err("Command runner is not instantiated")
  end

  runner.find_completions(line.split(/\s+/))
end