Sha256: 9ac557ef55bd6fa38f2585b259d0dcafcc0afa2c796fd7e4aec7df6db4ed894b

Contents?: true

Size: 995 Bytes

Versions: 30

Compression:

Stored size: 995 Bytes

Contents

# encoding: UTF-8

require "thor"

require_relative 'doi'
require_relative 'media'
require_relative 'metadata'

module Cirneco
  class CLI < Thor
    include Cirneco::Base
    include Cirneco::Api
    include Cirneco::Utils

    # load ENV variables from .env file if it exists
    env_file = File.expand_path("../../.env", __FILE__)
    if File.exist?(env_file)
      require 'dotenv'
      Dotenv.load! env_file
    end

    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 Cirneco::VERSION
    end

    desc "doi SUBCOMMAND", "doi commands"
    subcommand "doi", Cirneco::Doi

    desc "metadata SUBCOMMAND", "metadata commands"
    subcommand "metadata", Cirneco::Metadata

    desc "media SUBCOMMAND", "media commands"
    subcommand "media", Cirneco::Media
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
cirneco-0.8.5 lib/cirneco/cli.rb
cirneco-0.8.4 lib/cirneco/cli.rb
cirneco-0.8.3 lib/cirneco/cli.rb
cirneco-0.8.2 lib/cirneco/cli.rb
cirneco-0.8.1 lib/cirneco/cli.rb
cirneco-0.7.4 lib/cirneco/cli.rb
cirneco-0.7.3 lib/cirneco/cli.rb
cirneco-0.7.2 lib/cirneco/cli.rb
cirneco-0.7.1 lib/cirneco/cli.rb
cirneco-0.7 lib/cirneco/cli.rb