s7nio / mobileconfig

Ruby script to generate easy some kind of mobileconfigs
0 stars 0 forks source link

Create CLI #1

Open s7nio opened 7 years ago

s7nio commented 7 years ago

Create a command line interface for the ruby script.

s7nio commented 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