Class: Moviesort::CommandLine
- Inherits:
-
Object
- Object
- Moviesort::CommandLine
- Defined in:
- lib/moviesort/command_line.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #notifiers ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ CommandLine
Returns a new instance of CommandLine.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/moviesort/command_line.rb', line 13 def initialize(argv = ARGV) @options = Trollop.(argv) do <<-EOS.gsub(/^ {8}/, '') Moviesort is a script to sort and file away your TV shows and movies Usage: moviesort [options] EOS opt :source, "Source directory", :default => '.' opt :target, "Target directory", :default => '.' opt :notifiers, "Notifiers", :type => :string, :multi => true opt :twitteruser opt :twitterpass end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/moviesort/command_line.rb', line 7 def @options end |
Class Method Details
.parse(options) ⇒ Object
9 10 11 |
# File 'lib/moviesort/command_line.rb', line 9 def self.parse() new(.split) end |
Instance Method Details
#notifiers ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/moviesort/command_line.rb', line 35 def notifiers notifiers = [] if @options[:notifiers].include?('twitter') notifiers << Moviesort::Notifiers::Twitter.new(@options[:twitteruser], @options[:twitterpass]) end return notifiers end |