Class: Nehm::DlCommand

Inherits:
Command show all
Defined in:
lib/nehm/commands/dl_command.rb

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

#initializeDlCommand

Returns a new instance of DlCommand.



4
5
6
7
8
9
10
11
12
# File 'lib/nehm/commands/dl_command.rb', line 4

def initialize
  super

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

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

Instance Method Details

#argumentsObject



22
23
24
25
26
27
28
# File 'lib/nehm/commands/dl_command.rb', line 22

def arguments
  { 'post'         => 'Download last post (track or repost) from your profile',
    'NUMBER posts' => 'Download last NUMBER posts from your profile',
    'like'         => 'Download your last like',
    'NUMBER likes' => 'Download your last NUMBER likes',
    'URL'          => 'Download track from entered URL' }
end

#executeObject



14
15
16
17
18
19
20
# File 'lib/nehm/commands/dl_command.rb', line 14

def execute
  @options[:dl] = 'yes'

  get_cmd = CommandManager.command_instance('get')
  get_cmd.options = @options
  get_cmd.execute
end

#program_nameObject



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

def program_name
  'nehm dl'
end

#summaryObject



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

def summary
  'Download and set tags any track from SoundCloud'
end

#usageObject



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

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