Class: ComicBook::CLI
- Inherits:
-
Object
- Object
- ComicBook::CLI
- Defined in:
- lib/comic_book/cli.rb
Constant Summary collapse
- EXTRACT_FORMATS =
%w[.cb .cb7 .cbr .cbt .cbz .pdf].freeze
- ARCHIVE_FORMATS =
%w[.cb .cb7 .cbt .cbz].freeze
- INFO_FORMATS =
%w[.cb .cb7 .cbr .cbt .cbz].freeze
- UNSUPPORTED_FORMATS =
%w[.cba].freeze
- REDUNDANT_FIELDS =
Fields that duplicate others in a less useful form
%i[ genre genres_raw_data characters_raw_data teams_raw_data locations_raw_data story_arc story_arcs_raw_data story_arc_number story_arc_numbers_raw_data web_urls ].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.start(argv) ⇒ Object
23 24 25 |
# File 'lib/comic_book/cli.rb', line 23 def self.start argv new.start Array(argv) end |
Instance Method Details
#start(argv) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/comic_book/cli.rb', line 27 def start argv argv = Array argv if argv.include?('-v') || argv.include?('--version') puts ComicBook::VERSION return end if argv.empty? || argv.include?('-h') || argv.include?('--help') show_help return end case command = argv.shift when 'extract' then extract(argv) when 'archive' then archive(argv) when 'info' then info(argv) else puts "Unknown command: #{command}" show_help exit 1 end rescue ComicBook::Error, StandardError => e puts "Error: #{e.}" exit 1 end |