Sha256: cc0230184e2520d378feea1ed2847b28c967856162cd223bc7ff622cb53fbafc

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

module CustomCopsGenerator
  class CLI
    BANNER = <<~TEXT
      Usage: custom_cops_generator NAME
    TEXT

    def self.run(argv)
      new(argv).run
    end

    def initialize(argv)
      @argv = argv
    end

    def run
      # For --help
      opt = OptionParser.new(BANNER)
      args = opt.parse(@argv)

      name = args.first
      raise "It must be named `rubocop-*`. For example: rubocop-rspec" unless name.match?(/\Arubocop-\w+\z/)

      Generator.new(name).generate
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
custom_cops_generator-0.1.3 lib/custom_cops_generator/cli.rb
custom_cops_generator-0.1.2 lib/custom_cops_generator/cli.rb