class Modown::CLI

The CLI is a class responsible of handling all the command line interface logic.

Public Class Methods

new() click to toggle source
# File lib/modown.rb, line 12
def initialize
  @options = {}
end

Public Instance Methods

get_models(name, count = 1, format = '*.3[Dd][Ss]') click to toggle source

This method integrates the {download_model} , {search_models} and {get_model_from_zip} methods

@param name [String] the name of the thing you want to download 3D models.example “cat”,“bottle”,etc @param count [Integer] the number of models you want @param format [String] the glob pattern of the desired 3D model file format @return [void]

# File lib/modown.rb, line 29
def get_models(name, count = 1, format = '*.3[Dd][Ss]')
  Modown::search_models(name, count).each do |id|
    Modown::download_model(id)
    Modown::get_model_from_zip(id + '.zip', name + '_' + id, format)
  end
end
run(args = ARGV) click to toggle source

This method is the entry point for the command-line app

# File lib/modown.rb, line 17
def run(args = ARGV)
  @options = Options.new.parse(args)

  get_models(@options[:search_term], @options[:count], @options[:format])
end