Module: Options

Defined in:
lib/options.rb

Overview

Options ######################################

Instance Method Summary collapse

Instance Method Details

#get_options(args = ARGV) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/options.rb', line 6

def get_options args=ARGV
  opts=Trollop::options(args) do
    version "cleaner 1.1.1"
    banner <<-EOS
Cleaner is a program for automatically sorting files based on their extensions.

Usage:
     clean [options] <dirs>+

where [options] are:
EOS
    opt(:dry_run, "Just print commands, don't move anything",
        :default=>false)
    opt(:config_file, "Where to load mappings from",
        :default=>'~/.clean.yml', :type=>String)
    opt(:silent, "Don't print commands",
        :default=>false)
    opt(:on_collision, "If the destination file already exists, rename, overwrite, or ignore?",
        :default=>'rename')
  end

  opts[:dirs]=( args.empty? ? ['.'] : args )

  opts
end