Skip to content

Instantly share code, notes, and snippets.

@kawakami-o3
Last active January 15, 2018 12:07
Show Gist options
  • Save kawakami-o3/2b8de3f802cad894c737f9cae7260195 to your computer and use it in GitHub Desktop.
Save kawakami-o3/2b8de3f802cad894c737f9cae7260195 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'optparse'
if not File.exist? ".vagrant"
puts "not vagrant directory"
return -1
end
if not File.exist? ".vagrant_ssh_config"
system "vagrant ssh-config > .vagrant_ssh_config"
end
OPTS = {}
opt = OptionParser.new
opt.on('-c VAL') do |v|
OPTS[:c] = v
end
opt.parse(ARGV)
command = "ssh -F .vagrant_ssh_config default"
if OPTS.include?(:c)
command += " '#{OPTS[:c]}'"
end
#puts command
res = system command
unless res
puts "DO!!!: vagrant up"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment