Sha256: 9b6c734da4bf38180c419e64852771f1671ca40dafb9a5927f3b8eccb65df125
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
module MDQT class CLI require 'mdqt/cli/base' class Get < Base def run abort("Please specify --all if you wish to request all entities from #{options.service}") if args.empty? && !options.all results = get_results(args, options) #results = MetadataValidator.validate_responses(results) if options.validate #results = MetadataAggregator.aggregate_responses(results) if options.aggregate output_metadata(results, options) end def get_results(args, options) client = MDQT::Client.new( options.service, verbose: options.verbose, cache_type: options.cache ? :file : :none ) args.empty? ? [client.get_metadata("")] : args.collect {|entity_id| client.get_metadata(entity_id)} end def output_metadata(results, options) case action(results, options) when :save_files output_files(results, options) when :print_to_stdout output_to_stdout(results, options) else abort "Error - can't determine output type" end end def action(results, options) case when options.save :save_files else :print_to_stdout end end def output_to_stdout(results, options) results.each {|r| puts output(r)} end def output_files(results, options) abort "Unimplemented feature" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mdqt-0.2.1 | lib/mdqt/cli/get.rb |
mdqt-0.2.0 | lib/mdqt/cli/get.rb |