Class: Obp::Access::CLI
- Inherits:
-
Thor
- Object
- Thor
- Obp::Access::CLI
- Defined in:
- lib/obp/access/cli.rb
Instance Method Summary collapse
Instance Method Details
#catalog ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/obp/access/cli.rb', line 31 def catalog say "Loading catalog..." cat = Access::Catalog.load(path: [:path]) if [:filter] == "types" print_type_summary(cat) return end print_deliverables(cat) rescue StandardError => e say "Error: #{e.}", :red exit 1 end |
#fetch(urn) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/obp/access/cli.rb', line 12 def fetch(urn) langs = parse_languages if langs say "Fetching #{urn} (#{langs == :all ? 'all languages' : langs.join(', ')})..." Access.fetch_all(urn, languages: langs).each { |access| output(access) } else say "Fetching #{urn}..." output(Access.fetch(urn)) end rescue StandardError => e say "Error: #{e.}", :red exit 1 end |
#retrieve ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/obp/access/cli.rb', line 50 def retrieve say "Loading catalog..." cat = Access::Catalog.load(path: [:path]) say "Found #{cat.retrievable.size} retrievable deliverables" build_retriever(cat).run rescue StandardError => e say "Error: #{e.}", :red exit 1 end |