Sha256: 6e6d53ce4151984969e423d42eb97ca2997e73983d57eb88b3444f1d4cde0029
Contents?: true
Size: 1.48 KB
Versions: 10
Compression:
Stored size: 1.48 KB
Contents
require 'optparse' require 'vagrant/util/install_cli_autocomplete' module VagrantPlugins module CommandAutocomplete module Command class Install < Vagrant.plugin("2", :command) def execute options = { shells: [] } opts = OptionParser.new do |o| o.banner = "Usage: vagrant autocomplete install [-h] [shell name]" o.separator "" o.separator "Available shells: #{Vagrant::Util::InstallCLIAutocomplete::SUPPORTED_SHELLS.keys.join(' ')}" o.separator "" o.separator "Options:" o.separator "" o.on("-b", "--bash", "Install bash autocomplete") do |c| options[:shells].append("bash") end o.on("-z", "--zsh", "Install zsh autocomplete") do |c| options[:shells].append("zsh") end end # Parse the options argv = parse_options(opts) return if !argv raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length > 0 written_paths = Vagrant::Util::InstallCLIAutocomplete.install(options[:shells]) if written_paths && written_paths.length > 0 @env.ui.info(I18n.t("vagrant.autocomplete.installed", paths: written_paths.join("\n- "))) else @env.ui.info(I18n.t("vagrant.autocomplete.not_installed")) end # Success, exit status 0 0 end end end end end
Version data entries
10 entries across 10 versions & 3 rubygems