]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
figured out a workaround to make --version work as expected
authorelijah <elijah@riseup.net>
Fri, 2 Nov 2012 05:08:56 +0000 (22:08 -0700)
committerelijah <elijah@riseup.net>
Fri, 2 Nov 2012 05:08:56 +0000 (22:08 -0700)
bin/leap
lib/leap_cli/commands/pre.rb

index 582d313f962f92616977c5e9d4f749d5f25181ba..45f64fb2a9b3f8f66e0c36796d233ffa82723735 100755 (executable)
--- a/bin/leap
+++ b/bin/leap
@@ -64,7 +64,14 @@ module LeapCli::Commands
   #
   program_desc       LeapCli::SUMMARY
   program_long_desc  LeapCli::DESCRIPTION
-  version            LeapCli::VERSION
+
+  #
+  # handle --version ourselves
+  #
+  if ARGV.grep(/--version/).any?
+    puts "leap #{LeapCli::VERSION}, ruby #{RUBY_VERSION}"
+    exit(0)
+  end
 
   #
   # load commands and run
index d80a9c23ac8a5666ec1ced5b9a2bf871739c9b0f..a15a628ebfd61261de410a3a610fa3583c15d1df 100644 (file)
@@ -15,6 +15,9 @@ module LeapCli
     default_value Path.root
     flag [:root]
 
+    desc 'Display version number and exit'
+    switch :version, :negatable => false
+
     pre do |global,command,options,args|
       #
       # set verbosity