lib/hanzo/cli.rb in hanzo-1.0.2 vs lib/hanzo/cli.rb in hanzo-1.1.0
- old
+ new
@@ -5,22 +5,25 @@
require 'hanzo/modules/console'
module Hanzo
class CLI < Base
def run
- @options.parse!(@args) if @opts.respond_to? :parse!
+ @options.parse!(@args) if @options.respond_to? :parse!
puts @options unless @options.to_s == "Usage: hanzo [options]\n"
end
protected
def initialize_variables
@app = extract_argument(0)
end
def initialize_cli
- initialize_help && return if @app.nil?
+ @options.on('-v', '--version', 'Print version') do
+ puts "Hanzo #{Hanzo::VERSION}"
+ exit
+ end
begin
@options = Hanzo.const_get(@app.capitalize).new(@args).options
rescue NameError
initialize_help
@@ -38,10 +41,9 @@
config - Manage Heroku configuration variables
console - Run a console command
Options:
BANNER
- @options.on('-h', '--help', 'You\'re looking at it.') { puts @options }
- @options.on('-v', '--version', 'Print version') { puts "Hanzo #{Hanzo::VERSION}" }
+ @options.on('-h', '--help', 'You\'re looking at it.')
end
end
end