1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Added option parsing to bin/fog.

* Added -V, --version
* Added -h, --help
This commit is contained in:
Postmodern 2013-06-25 17:11:28 -07:00
parent e93a632167
commit b00f8e65e7

18
bin/fog
View file

@ -1,7 +1,25 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
require 'optparse'
require 'irb'
require 'yaml'
options = OptionParser.new do |opts|
opts.banner = 'usage: fog [options] GROUP'
opts.on_tail('-V', '--version', 'Prints the version') do
puts Fog::VERSION
exit
end
opts.on_tail('-h', '--help', 'Prints this message') do
puts opts
exit
end
end
options.parse!
Fog.credential = ARGV.first ? ARGV.first.to_sym : nil
Fog.mock! if ENV['FOG_MOCK']
if Fog.credentials.empty?