Sha256: 07afa976131cece089f4f4bacea341772cd671e9ccaa9289aa0f3da37b9f3d84

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 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

    private def to_dirname(name)
      name.sub('-', '/')
    end

    private def to_classname
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
custom_cops_generator-0.1.1 lib/custom_cops_generator/cli.rb
custom_cops_generator-0.1.0 lib/custom_cops_generator/cli.rb