Sha256: e5c5e668d1429a88c2bb6952b490c422af6c0dcf7ef4e0abe0dd07f45651f4ee

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

require 'optparse'

module VagrantPlugins
  module Qubes
    class CapAddress < Vagrant.plugin(2, :command)
      def self.synopsis
          "outputs the IP address of a guest."
      end
      def execute
        opts = OptionParser.new do |o|
          o.banner = "Usage: vagrant address [name]"
        end

        argv = parse_options(opts)

        # Count total number of vms to print the IP
        totalvms = 0
        with_target_vms(argv) do
          totalvms += 1
        end

        if argv.length == 1 or totalvms == 1
          with_target_vms(argv, {:single_target=>true}) do |machine|
            machine.action(:address)
          end
        else
          with_target_vms(argv) do |machine|
            machine.action(:address_multi)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-qubes-0.0.5 lib/vagrant-qubes/command.rb
vagrant-qubes-0.0.4 lib/vagrant-qubes/command.rb