environment/bin/vm

35 lines
727 B
Text
Raw Normal View History

2025-08-11 10:20:07 +02:00
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'virtual-machine'
# vm setup debian --arch "<host:arch64>" --name "<image_name: debian>"
options = OpenStruct.new
subcommand = ARGV.shift&.to_sym
2025-08-11 14:18:59 +02:00
parameter = ARGV[0] && ARGV[0] !~ /^-/ ? ARGV.shift : nil
2025-08-11 10:20:07 +02:00
OptionParser.new do |opt|
opt.on('--arch ARCH', 'Architecture arm64 or x86_64') do |arch|
options.arch = arch
end
2025-08-11 14:18:59 +02:00
opt.on('--name NAME', 'Virtaul Machine name') do |name|
options.name = name
2025-08-11 10:20:07 +02:00
end
# new from copy
# fetch from the server
2025-08-11 10:20:07 +02:00
end.parse!
case subcommand
when :create
puts "Creating image...."
when :setup
2025-08-11 14:18:59 +02:00
options[:distro] = parameter
2025-08-11 10:20:07 +02:00
VirtualMachine.setup(options)
else
puts "Error not found #{options.type}"
end