Permalink
Browse files

added version flag

  • Loading branch information...
1 parent 33fe494 commit 5c43924d38b1080f81adaeab6b261a35f8724285 @wbailey committed May 27, 2012
Showing with 22 additions and 5 deletions.
  1. +10 −5 bin/claws
  2. +2 −0 lib/claws.rb
  3. +10 −0 lib/claws/command/version.rb
  4. BIN pkg/claws-1.1.0.gem
View
@@ -9,6 +9,7 @@ options = OpenStruct.new(
:config_file => nil,
:connect => true,
:initialize => false,
+ :version => false,
:selection => nil,
}
)
@@ -27,10 +28,14 @@ OptionParser.new do |opts|
opts.on('-i', '--init', 'Install the default configuration file for the application') do
options.initialize = true
end
+
+ opts.on('-v', '--version', 'Display the version number and exit') do
+ options.version = true
+ end
end.parse!
-if options.initialize
- Claws::Command::Initialize.exec
-else
- Claws::Command::EC2.exec options
-end
+Claws::Command::Initialize.exec if options.initialize
+
+Claws::Command::Version.exec if options.version
+
+Claws::Command::EC2.exec options
View
@@ -1,6 +1,8 @@
+require 'claws/version'
require 'claws/options'
require 'claws/configuration'
require 'claws/collection/ec2'
require 'claws/report/ec2'
require 'claws/command/initialize'
require 'claws/command/ec2'
+require 'claws/command/version'
@@ -0,0 +1,10 @@
+module Claws
+ module Command
+ class Version
+ def self.exec
+ puts Claws::VERSION
+ exit 0
+ end
+ end
+ end
+end
View
Binary file not shown.

0 comments on commit 5c43924

Please sign in to comment.