Sha256: 481be4ec40946a7c2e8c9c4247861c0986b48e10cf7197cc5650fecbcac1b5c5

Contents?: true

Size: 930 Bytes

Versions: 10

Compression:

Stored size: 930 Bytes

Contents

require 'thor'
require 'orats/commands/new'
require 'orats/version'

module Orats
  # thor driven command line interface
  class CLI < Thor
    option :template, default: 'base', aliases: '-t'
    desc 'new PATH [options]', 'Create a new orats application'
    long_desc File.read(File.join(File.dirname(__FILE__), 'cli_help/new'))
    def new(target_path)
      Commands::New.new(target_path, options).init
    end

    desc 'templates', 'Return a list of available templates'
    long_desc 'Return a list of available built in templates.'
    def templates
      Commands::New.new.available_templates
    end

    desc 'version', 'The current version of orats'
    long_desc 'Print the current version.'
    def version
      puts "orats version #{VERSION}"
    end

    map %w(-v --version) => :version

    private

    def invoked?
      caller_locations(0).any? { |backtrace| backtrace.label == 'invoke' }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
orats-5.2.3 lib/orats/cli.rb
orats-5.2.2 lib/orats/cli.rb
orats-5.2.1 lib/orats/cli.rb
orats-5.2.0 lib/orats/cli.rb
orats-5.1.2 lib/orats/cli.rb
orats-5.1.1 lib/orats/cli.rb
orats-5.0.3 lib/orats/cli.rb
orats-5.0.2 lib/orats/cli.rb
orats-5.0.1 lib/orats/cli.rb
orats-5.0.0 lib/orats/cli.rb