Sha256: 41f7093c30aea01fd4ddd5715fd14790595b80330953e7044a9f864d8fd0c0f5

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

require 'thor'
require_relative 'generators/plugin'
require_relative 'version'

module Coprl
  module Presenters
    class SubCommandBase < Thor
      def self.banner(command, namespace = nil, subcommand = false)
        "#{basename} #{subcommand_prefix} #{command.usage}"
      end

      def self.subcommand_prefix
        self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
      end
    end

      class Generate < SubCommandBase
        desc "plugin", "generates a plugin"
        def plugin(name)
          Generators::Plugin.start([name])
        end
      end
      class Cli < Thor
        def self.exit_on_failure?
          true
        end
        map %w[--version -v] => :__print_version

        desc "--version, -v", "print the version"
        def __print_version
          puts Coprl::Presenters::Version::VERSION
        end
        desc "generate", "generate a plugin"
        subcommand "generate", Generate
      end
    end
  end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/cli.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/cli.rb