Class: EbookRenamer::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ebook_renamer/cli.rb

Instance Method Summary collapse

Instance Method Details

#renameObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/ebook_renamer/cli.rb', line 26

def rename
  opts = options.deep_symbolize_keys
  # Explicitly add the :exts options
  opts[:exts] = %w[pdf epub mobi]
  if opts[:version]
    puts "You are using EbookRenamer version #{EbookRenamer::VERSION}"
    exit
  end
  execute(opts)
end

#usageObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ebook_renamer/cli.rb', line 38

def usage
  puts <<-EOS
Usage:
  ebook_renamer

Options:
  -b, [--base-dir=BASE_DIR]              # Base directory
                                     # Default: . (current directory)
  -r, [--recursive], [--no-recursive]    # Search for files recursively
                                     # Default: --recursive
  -s, [--sep-string=SEP_STRING]          # Separator string between each word in output filename
                                     # Default: '_' (underscore)
  -d, [--downcase], [--no-downcase]      # Convert each word in the output filename to lowercase
                                     # Default: --no-downcase
  -t, [--capitalize], [--no-capitalize]  # Capitalize each word in the output filename
                                     # Default: --no-capitalize
  -c, [--commit], [--no-commit]          # Make your changes permanent
                                     # Default: --no-commit
  -v, [--version], [--no-version]        # Display version information

Rename multiple ebook files (pdf,epub,mobi) from a given directory

  EOS
end