Sha256: 924215473dcb0885d720d310bbc7558120d54ccd653f8b96d4e51e37d1a421ed

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

require 'thor'
require_relative 'generators/plugin'

module Voom
  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
        desc "generate", "generate a plugin"
        subcommand "generate", Generate
      end
    end
  end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voom-presenters-2.1.2 lib/voom/presenters/cli.rb
voom-presenters-2.1.0 lib/voom/presenters/cli.rb
voom-presenters-2.0.3 lib/voom/presenters/cli.rb
voom-presenters-2.0.2 lib/voom/presenters/cli.rb
voom-presenters-2.0.1 lib/voom/presenters/cli.rb
voom-presenters-2.0.0 lib/voom/presenters/cli.rb