Class: Nehm::ListCommand

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

Overview

This command gets list of 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

#initializeListCommand

Returns a new instance of ListCommand.



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/list_command.rb', line 11

def initialize
  super

  add_option(:from, 'from PERMALINK',
             'Get list of 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/list_command.rb', line 33

def arguments
  { 'likes' => 'List of likes',
    'posts' => 'List of posts' }
end

#executeObject



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

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

#program_nameObject



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

def program_name
  'nehm list'
end

#summaryObject



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

def summary
  'Get list of likes or posts from your account and download, set tags ' \
                                              'and add to iTunes selected'
end

#usageObject



52
53
54
# File 'lib/nehm/commands/list_command.rb', line 52

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