Sha256: eabdd4250e13786befccc576fbbeba2c7d1dc735912647e6d4d6ed6b33e8014f

Contents?: true

Size: 852 Bytes

Versions: 4

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

require 'thor'
require 'fakerbot/cli'
require 'fakerbot/version'
require 'fakerbot/commands/search'

module FakerBot
  class CLI < Thor
    Error = Class.new(StandardError)

    desc 'version', 'fakerbot version'
    def version
      require_relative 'version'
      puts "v#{FakerBot::VERSION}"
    end
    map %w[--version -v] => :version

    desc 'search [Faker]', 'Search Faker method(s)'
    method_option :help, aliases: '-h', type: :boolean,
                         desc: 'Display usage information'
    method_option :verbose, aliases: '-v', type: :boolean,
                            desc: 'Display Faker classes with methods'
    def search(query)
      if options[:help]
        invoke :help, ['search']
      else
        FakerBot::Commands::Search.new(options).execute(query)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fakerbot-0.2.4 lib/fakerbot/cli.rb
fakerbot-0.2.3 lib/fakerbot/cli.rb
fakerbot-0.2.0 lib/fakerbot/cli.rb
fakerbot-0.1.2 lib/fakerbot/cli.rb