Class: Modown::CLI
- Inherits:
-
Object
- Object
- Modown::CLI
- Defined in:
- lib/modown.rb
Overview
The CLI is a class responsible of handling all the command line interface logic.
Instance Method Summary collapse
-
#get_models(name, count = 1, format = '*.3[Dd][Ss]') ⇒ void
This method integrates the download_model , search_models and get_model_from_zip methods.
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
-
#run(args = ARGV) ⇒ Object
This method is the entry point for the command-line app.
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
12 13 14 |
# File 'lib/modown.rb', line 12 def initialize = {} end |
Instance Method Details
#get_models(name, count = 1, format = '*.3[Dd][Ss]') ⇒ void
This method returns an undefined value.
This method integrates the Modown.download_model , Modown.search_models and Modown.get_model_from_zip methods
29 30 31 32 33 34 |
# 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) ⇒ Object
This method is the entry point for the command-line app
17 18 19 20 21 |
# File 'lib/modown.rb', line 17 def run(args = ARGV) = Options.new.parse(args) get_models([:search_term], [:count], [:format]) end |