Class: Moviesort::CommandLine
- Inherits:
-
Object
- Object
- Moviesort::CommandLine
- Defined in:
- lib/moviesort/command_line.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #run ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ CommandLine
Returns a new instance of CommandLine.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/moviesort/command_line.rb', line 10 def initialize(argv = ARGV) = Trollop.(argv) do " Moviesort is a script to sort and file away your TV shows and movies\n\n Usage: moviesort [options]\n EOS\n\n opt :source, \"Source directory\", :default => '.'\n opt :target, \"Target directory\", :default => '.'\n end\nend\n".gsub(/^ {8}/, '') |
Class Method Details
.parse(options) ⇒ Object
6 7 8 |
# File 'lib/moviesort/command_line.rb', line 6 def self.parse() new(.split) end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 |
# File 'lib/moviesort/command_line.rb', line 23 def run sorter = Sorter::TV.new([:target]) Dir[File.join([:source], '*.avi')].each do |file| sorter.sort_file(file) end end |