Open s7nio opened 7 years ago
e.g. mobileconfig-cli.rb ...
#!/usr/bin/ruby
require 'optparse'
options = {}
opt_parser = OptionParser.new do |opt|
opt.banner = "Usage: mobileconfig generator COMMAND [OPTIONS]"
opt.separator ""
opt.separator "Commands"
opt.separator " wlan: generate a wpa(2) profile"
opt.separator ""
opt.separator "Options"
opt.on("-e","--environment ENVIRONMENT","which environment you want to setup") do |environment|
options[:environment] = environment
end
opt.on("-h","--help","help") do
puts opt_parser
end
end
opt_parser.parse!
case ARGV[0]
when "wlan"
puts "... #{options.inspect}"
else
puts opt_parser
end
Create a command line interface for the ruby script.