Sha256: 62838a305e95768b5b1e3e7d68a5c20e1d423bf245b8044168ffb46b2f90ea99

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

require "thor"
require "hasmenu/version"
require "hasmenu/printer"
require "hasmenu/formatter"
require "hasmenu/spellchecker"
require "hasmenu/validator"
require "hasmenu/builder"
require "hasmenu/reporter"

module Hasmenu
  class Cli < Thor
    map %w(--version -v) => :__print_version

    desc "--version, -v", "Print the version"
    def __print_version
      puts Hasmenu::VERSION
    end

    desc "format <path>", "Format Has.Menu data"
    option :location, aliases: :l, desc: "Path to data repository"
    def format(path)
      Hasmenu::Formatter.new(options).format(path)
    end
    map "f" => :format

    desc "spellcheck <path>", "Run spellcheck on Has.Menu data"
    option :dicts, aliases: :d, desc: "Path to dictionary files"
    option :except, aliases: :e, desc: "Exception file id"
    def spellcheck(path)
      Hasmenu::SpellChecker.new(options).check(path)
    end
    map "sc" => :spellcheck

    desc "validate <type> <path>", "Run validation on Has.Menu data"
    option :schema, aliases: :s, desc: "Path to schema files"
    def validate(type, path)
      Hasmenu::Validator.new(type, options).perform(path)
    end
    map "v" => :validate

    desc "build <type> [uid] [menu-uid]", "Build one or more restaurant menus from chain menu"
    option :location, aliases: :l, desc: "Path to data repository"
    def build(type, uid = nil, menu_uid = nil)
      Hasmenu::Builder.new(type, options).build(uid, menu_uid)
    end
    map "b" => :build

    desc "report <type>", "Report the status and metrics from the repository"
    option :location, aliases: :l, desc: "Path to data repository"
    def report(type)
      Hasmenu::Reporter.new(type, options).report
    end
    map "r" => :report
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hasmenu-0.1.5 lib/hasmenu.rb
hasmenu-0.1.4 lib/hasmenu.rb