Class: Vagrant::Util::InstallCLIAutocomplete

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/util/install_cli_autocomplete.rb

Overview

Install autocomplete script for supported shells

Constant Summary collapse

SUPPORTED_SHELLS =
{
  "zsh" => Vagrant::Util::InstallZSHShellConfig.new(),
  "bash" => Vagrant::Util::InstallBashShellConfig.new()
}

Class Method Summary collapse

Class Method Details

.install(shells = []) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/vagrant/util/install_cli_autocomplete.rb', line 105

def self.install(shells=[])
  shells = SUPPORTED_SHELLS.keys() if shells.empty?
  home = Dir.home
  written_paths = []
  
  shells.map do |shell|
    if SUPPORTED_SHELLS[shell]
      written_paths.push(SUPPORTED_SHELLS[shell].install(home))
    else
      raise ArgumentError, "shell must be in #{SUPPORTED_SHELLS.keys()}"
    end
  end.compact
  return written_paths
end