bin/birstcl in Birst_Command-0.2.0 vs bin/birstcl in Birst_Command-0.2.1
- old
+ new
@@ -1,13 +1,7 @@
#!/usr/bin/env ruby
-# FOR TESTING ONLY
-$LOAD_PATH << File.join(File.dirname(__FILE__),"../lib")
-require 'rubygems'
-require 'bundler/setup'
-# REMOVE THE ABOVE
-
require "birst_command"
require "optparse"
module BirstCL
extend self
@@ -20,10 +14,15 @@
opts.on("--verbose", "--[no-]verbose", "Run verbosely") do |v|
@options[:verbose] = v
end
+ @options[:version] = false
+ opts.on("--version", "--version", "Print version") do |v|
+ @options[:version] = true
+ end
+
opts.on("-h","--help", "Show this message") do
puts opts
exit
end
@@ -47,9 +46,14 @@
@options[:config_full_path] = "#{ENV['HOME']}/.birstcl"
opts.on("-s","--config_file <CONFIG FILE>", "Path to config file containing credentials (default: $HOME/.birstcl)") do |opt|
@options[:config_full_path] = opt
end
end.parse!
+
+ if @options[:version]
+ puts "Birst_Command Version: #{Birst_Command::VERSION}"
+ exit
+ end
end
def read_config_file
Birst_Command::Config.read_config(@options[:config_full_path])