Class: Nehm::SelectCommand

Inherits:
TracksViewCommand show all
Defined in:
lib/nehm/commands/select_command.rb

Overview

This command gets likes/posts from user’s account, Prints as menu, and downloads selected tracks

Constant Summary

Constants inherited from TracksViewCommand

TracksViewCommand::DEFAULT_LIMIT, TracksViewCommand::DEFAULT_OFFSET

Instance Attribute Summary

Attributes inherited from Command

#options, #options_descs

Instance Method Summary collapse

Methods inherited from Command

#add_option, #handle_options, #invoke

Constructor Details

#initializeSelectCommand

Returns a new instance of SelectCommand.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nehm/commands/select_command.rb', line 11

def initialize
  super

  add_option(:from, 'from PERMALINK',
             'Select track(s) from user with PERMALINK')

  add_option(:to, 'to PATH',
             'Download track(s) to PATH')

  add_option(:pl, 'pl PLAYLIST',
             'Add track(s) to iTunes playlist with PLAYLIST name')

  add_option(:limit, 'limit NUMBER',
             'Show NUMBER tracks on each page')

  add_option(:offset, 'offset NUMBER',
             'Show from NUMBER+1 track')

  add_option(:dl, 'dl yes',
             "Don't add tracks to iTunes. Just download and set tags")
end

Instance Method Details

#argumentsObject



33
34
35
36
# File 'lib/nehm/commands/select_command.rb', line 33

def arguments
  { 'likes' => 'Select likes',
    'posts' => 'Select posts' }
end

#executeObject



42
43
44
45
# File 'lib/nehm/commands/select_command.rb', line 42

def execute
  @type = @options[:args].shift
  super
end

#program_nameObject



38
39
40
# File 'lib/nehm/commands/select_command.rb', line 38

def program_name
  'nehm select'
end

#summaryObject



47
48
49
# File 'lib/nehm/commands/select_command.rb', line 47

def summary
  'Get likes or posts from your account, nicely print them and download selected tracks'
end

#usageObject



51
52
53
# File 'lib/nehm/commands/select_command.rb', line 51

def usage
  "#{program_name} ARGUMENT [OPTIONS]"
end