Sha256: db93f9d564334bc5a59fb33cca75c72a338419eefbbc6185160a537066c0aef1
Contents?: true
Size: 1.25 KB
Versions: 5
Compression:
Stored size: 1.25 KB
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? false 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 :schema_version def convert(input) id = normalize_id(input) if id.present? from = options[:from] || find_from_format(id: id) else ext = File.extname(input) if %w(.bib .xml).include? ext string = IO.read(input) else $stderr.puts "File type #{ext} not supported" exit 1 end from = options[:from] || find_from_format(string: string, ext: ext) end to = options[:to] || "schema_org" write(id: id, string: string, from: from, to: to, schema_version: options[:schema_version]) end default_task :convert end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
bolognese-0.7 | lib/bolognese/cli.rb |
bolognese-0.6.6 | lib/bolognese/cli.rb |
bolognese-0.6.5 | lib/bolognese/cli.rb |
bolognese-0.6.4 | lib/bolognese/cli.rb |
bolognese-0.6.3 | lib/bolognese/cli.rb |