Sha256: d6dad164a209b6bb026b0369dba585e223adbf43d0586f85ef4e8c179a58b2a8

Contents?: true

Size: 925 Bytes

Versions: 27

Compression:

Stored size: 925 Bytes

Contents

# encoding: UTF-8

require "thor"

require_relative 'doi_utils'
require_relative 'utils'

module Bolognese
  class CLI < Thor
    include Bolognese::DoiUtils
    include Bolognese::Utils

    def self.exit_on_failure?
      true
    end

    # from http://stackoverflow.com/questions/22809972/adding-a-version-option-to-a-ruby-thor-cli
    map %w[--version -v] => :__print_version

    desc "--version, -v", "print the version"
    def __print_version
      puts Bolognese::VERSION
    end

    desc "", "convert metadata"
    method_option :from, aliases: "-f"
    method_option :to, aliases: "-t", default: "schema_org"
    method_option :regenerate, :type => :boolean, :force => false
    def convert(input)
      metadata = Metadata.new(input: input, from: options[:from], regenerate: options[:regenerate])
      to = options[:to] || "schema_org"
      puts metadata.send(to)
    end

    default_task :convert
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bolognese-0.9.16 lib/bolognese/cli.rb
bolognese-0.9.15 lib/bolognese/cli.rb
bolognese-0.9.14 lib/bolognese/cli.rb
bolognese-0.9.13 lib/bolognese/cli.rb
bolognese-0.9.11 lib/bolognese/cli.rb
bolognese-0.9.10 lib/bolognese/cli.rb
bolognese-0.9.9 lib/bolognese/cli.rb