Sha256: bcd2629edf74bcf2f5d6514e034010b75d81c37fa41cc8b745a69837006941ba

Contents?: true

Size: 902 Bytes

Versions: 5

Compression:

Stored size: 902 Bytes

Contents

module Rpub
  module Commands
    class Main < Base

      def invoke
        options << '-h' if options.empty?
        super
        raise InvalidSubcommand, options[0] unless options.empty?
      end

    protected

      def parser
        OptionParser.new do |opts|
          opts.banner = <<-EOS
Usage: rpub [subcommand] [options]

Compile multiple Markdown-formatted input files into a machine-readable epub
file for distribution as an ebook.

Available subcommands:

  compile
  preview
  clean
  package
  help
EOS

          opts.separator ''
          opts.separator 'Generic options:'
          opts.separator ''

          opts.on_tail '-v', '--version', 'Display version information' do
            puts "rpub #{Rpub::VERSION}"
          end

          opts.on_tail '-h', '--help', 'Display command reference' do
            puts opts
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rpub-0.4.0 lib/rpub/commands/main.rb
rpub-0.3.0 lib/rpub/commands/main.rb
rpub-0.2.1 lib/rpub/commands/main.rb
rpub-0.2.0 lib/rpub/commands/main.rb
rpub-0.1.0 lib/rpub/commands/main.rb