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.36 lib/bolognese/cli.rb
bolognese-0.9.35 lib/bolognese/cli.rb
bolognese-0.9.34 lib/bolognese/cli.rb
bolognese-0.9.33 lib/bolognese/cli.rb
bolognese-0.9.32 lib/bolognese/cli.rb
bolognese-0.9.31 lib/bolognese/cli.rb
bolognese-0.9.30 lib/bolognese/cli.rb
bolognese-0.9.29 lib/bolognese/cli.rb
bolognese-0.9.28 lib/bolognese/cli.rb
bolognese-0.9.27 lib/bolognese/cli.rb
bolognese-0.9.26 lib/bolognese/cli.rb
bolognese-0.9.25 lib/bolognese/cli.rb
bolognese-0.9.24 lib/bolognese/cli.rb
bolognese-0.9.23 lib/bolognese/cli.rb
bolognese-0.9.22 lib/bolognese/cli.rb
bolognese-0.9.21 lib/bolognese/cli.rb
bolognese-0.9.20 lib/bolognese/cli.rb
bolognese-0.9.19 lib/bolognese/cli.rb
bolognese-0.9.18 lib/bolognese/cli.rb
bolognese-0.9.17 lib/bolognese/cli.rb