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:
parent
e93a632167
commit
b00f8e65e7
1 changed files with 18 additions and 0 deletions
18
bin/fog
18
bin/fog
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue