lib/bookscan/cli.rb in bookscan-0.4.1 vs lib/bookscan/cli.rb in bookscan-0.4.3

- old
+ new

@@ -11,10 +11,11 @@ end def execute(argv) begin @opt = OptionParser.new + @opt.on('--version', 'show version') { version;exit } @opt.on('--help', 'show this message') { usage;exit } @opt.on('--debug', 'debug mode') { @options[:debug] = true } cmd_argv = @opt.order!(argv) cmd = cmd_argv.shift Commands.new(cmd_argv,@options).send(cmd) @@ -25,9 +26,19 @@ end end def usage(e=nil) puts @opt + puts "\nCommands:\n" + COMMANDS.each { |c| + puts " " + c + } + end + + def version + File.open(File.dirname(__FILE__) + '/../../VERSION',"r") { |file| + puts file.gets + } end class << self def run(argv) self.new.execute(argv)