Class: EbooksRenamer::CLI

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

Instance Method Summary collapse

Instance Method Details

#renameObject



16
17
18
19
20
21
22
23
24
25
26
# 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

#usageObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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