class Source2Epub::CLI

Public Instance Methods

export() click to toggle source
# File lib/source2epub/cli.rb, line 28
def export
  exporter = Source2Epub::Exporter.new options[:url],
                                       exts:       options[:exts],
                                       non_exts:   options[:non_exts],
                                       theme:      options[:theme],
                                       command:    options[:command],
                                       epub_title: options[:epub_title]
  exporter.export
end
usage() click to toggle source
# File lib/source2epub/cli.rb, line 39
    def usage
      puts <<-EOS
Usage:

  $source2epub -u, --url=URL -e, --exts=EXT1 EXT2 EXT3 -t, -theme=theme_name

Example:

  # Export the *.rb from the given repository

  $source2epub -u https://github.com/agilecreativity/source2epub.git -e rb

  # Export the *.rb and also 'Gemfile' from a local directory 'source2epub'
  # Note: must be one directory directly above the current directory

  $source2epub -u source2epub -e rb -f Gemfile

  # Export the *.rb and also 'Gemfile' from a given directory 'source2epub'
  # using 'solarized' theme
  # Note: 'source2epub' must be exactly one level above current directory

  $source2epub -u source2epub -e rb -f Gemfile -t solarized

Options:

  -u, --url=URL                   # The full url of the github project to be cloned or local directory name (mandatory)
                                  # e.g. -u https://github.com/agilecreativity/source2epub
                                  # Or if used with the project already exist locally
                                  #      -u source2epub

  -e, --exts=EXT1 EXT2 EXT3 ..    # The list of extension names to be exported (mandatory)
                                  # e.g. -e md rb

  -f, [--non-exts=one two three]  # The list of file without extension to be exported (optional)
                                  # e.g. -f Gemfile LICENSE

  -t, [--theme=theme_name]        # The theme to be used with vim_printer see :help :colorscheme from inside Vim
                                  # default: 'default'
                                  # e.g. -t solarized

  -p, [--epub-title=title]        # The title of the epub output, if not specified the project_name will be used
                                  # e.g. -p 'My Cool Project'
                                  #
  -s, [--command]                 # Use the input file list from the result of the given shell command
                                  # Note: the command must return the list of file to be valid
                                  # e.g. --command 'find . -type f -iname "*.rb" | grep -v test | grep -v _spec'

Export a given git URL or local project directory to an epub file"

      EOS
    end