Class: EbooksRenamer::CLI

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

Instance Method Summary collapse

Instance Method Details

#renameObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ebooks_renamer/cli.rb', line 22

def rename
  opts = options.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



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ebooks_renamer/cli.rb', line 35

def usage
  puts <<-EOS

Usage:
  ebooks_renamer rename

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