Class: FilenameCleaner::CLI

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

Instance Method Summary collapse

Instance Method Details

#renameObject



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

def rename
  opts = options.deep_symbolize_keys
  if opts[:version]
    puts "You are using Filename Cleaner version #{FilenameCleaner::VERSION}"
    exit
  end
  sanitize_and_rename(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/filename_cleaner/cli.rb', line 38

def usage
  puts <<-EOS
Usage:
  filename_cleaner

Options:
  -b, [--base-dir=BASE_DIR]                # Base directory
                                       # Default: . (current directory)
  -e, [--exts=one two three]               # List of extensions to search for
  -r, [--recursive], [--no-recursive]      # Search for files recursively
                                       # Default: true
  -s, [--sep-char=SEP_CHAR]                # Separator char to use
                                       # Default: _
  -d, [--downcase], [--no-downcase]        # Convert each word int the filename to lowercase
                                       # Default: --no-downcase
  -t, [--capitalize], [--no-capitalize]    # Capitalize each word in the filename
                                       # Default: --no-capitalize
  -c, [--commit], [--no-commit]            # Commit your changes
                                       # Default: --no-commit
  -v, [--version], [--no-version]          # Display version information
                                       # Default: --no-version
Sanitize and rename file with special characters
  EOS
end