class EbooksRenamer::CLI

Public Instance Methods

rename() click to toggle source
# File lib/ebooks_renamer/cli.rb, line 16
def rename
  opts = options.deep_symbolize_keys
  if opts[:version]
    puts "You are using EbooksRenamer version #{EbooksRenamer::VERSION}"
    exit
  end
  # Add the default supported extensions
  opts.merge!(exts: %w[pdf epub mobi])
  puts "Your options #{opts}"
  EbooksRenamer.rename(opts)
end
usage() click to toggle source
# File lib/ebooks_renamer/cli.rb, line 29
    def usage
      puts <<-EOS

Usage:
  ebooks_renamer

Options:
  -b, [--base-dir=BASE_DIR]                # Base directory
                                           # Default: . (current directory)
  -r, [--recursive], [--no-recursive]      # Search for files recursively
                                           # Default: true
  -v, [--version], [--no-version]          # Display version information
  -s, [--sep-string=SEP_STRING]            # Separator string between words in filename
                                           # Default: .
  -c, [--commit], [--no-commit]            # Make change permanent

Rename ebooks based on given criteria
      EOS
    end