Module: EpubTools::CLI
- Defined in:
- lib/epub_tools/cli.rb,
lib/epub_tools/cli/runner.rb,
lib/epub_tools/cli/option_builder.rb,
lib/epub_tools/cli/command_registry.rb
Overview
CLI module - houses the object-oriented command line interface components
Defined Under Namespace
Classes: CommandRegistry, OptionBuilder, Runner
Class Method Summary collapse
-
.create_runner(program_name = nil) ⇒ CLI::Runner
Create a new Runner instance configured with all available commands.
Class Method Details
.create_runner(program_name = nil) ⇒ CLI::Runner
Create a new Runner instance configured with all available commands
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/epub_tools/cli.rb', line 11 def self.create_runner(program_name = nil) runner = Runner.new(program_name) # Register all commands runner.registry.register('add', EpubTools::AddChapters, %i[chapters_dir oebps_dir]) runner.registry.register('extract', EpubTools::XHTMLExtractor, %i[source_dir target_dir], { verbose: true }) runner.registry.register('split', EpubTools::SplitChapters, %i[input_file book_title], { output_dir: './chapters', prefix: 'chapter', verbose: true }) runner.registry.register('init', EpubTools::EpubInitializer, %i[title author destination], { verbose: true }) runner.registry.register('pack', EpubTools::PackEbook, %i[input_dir output_file], { verbose: true }) runner.registry.register('unpack', EpubTools::UnpackEbook, [:epub_file], { verbose: true }) runner.registry.register('compile', EpubTools::CompileBook, %i[title author source_dir], { verbose: true }) runner end |