Sha256: 3712b866264afb11139759804d84d830d468f1578f7859700f12af66753f4d59

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

require 'hanzo/modules/deploy'
require 'hanzo/modules/install'

module Hanzo
 class CLI < Base
    def run
      @options.parse!(@args) if @opts.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 and return if @app.nil?

      @options = Hanzo.const_get(@app.capitalize).new(@args).options
    end

    def initialize_help
      @options.banner = <<-BANNER
Usage: hanzo action [options]

Available actions:
   deploy — Deploy a branch or a tag
  install — Install Hanzo configuration

Options:
BANNER
      @options.on('-h', '--help', 'You\'re looking at it.') { puts @options }
      @options.on('-v', '--version', 'Print version') { puts "Hanzo #{Hanzo::VERSION}" }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanzo-0.1.0 lib/hanzo/cli.rb