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
# 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')
end

Instance Method Details

#argumentsObject



30
31
32
33
# File 'lib/nehm/commands/select_command.rb', line 30

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

#executeObject



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

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

#program_nameObject



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

def program_name
  'nehm select'
end

#summaryObject



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

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

#usageObject



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

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