Class: Nehm::SearchCommand
Constant Summary
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
Returns a new instance of SearchCommand.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/nehm/commands/search_command.rb', line 7
def initialize
super
add_option(:"-t", '-t PATH',
'Download track(s) to PATH')
add_option(:"-pl", '-pl PLAYLIST',
'Add track(s) to iTunes playlist with PLAYLIST name')
add_option(:"-lim", '-lim NUMBER',
'Show NUMBER tracks on each page')
add_option(:"-dl", '-dl yes',
"Don't add tracks to iTunes. Just download and set tags")
end
|
Instance Method Details
#arguments ⇒ Object
41
42
43
|
# File 'lib/nehm/commands/search_command.rb', line 41
def arguments
{ 'QUERY' => 'Search query' }
end
|
#execute ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/nehm/commands/search_command.rb', line 24
def execute
options_to_convert = { :"-t" => :to,
:"-pl" => :pl,
:"-lim" => :limit,
:"-dl" => :dl }
options_to_convert.each do |k, v|
value = @options[k]
@options.delete(k)
@options[v] = value unless value.nil?
end
@query = @options[:args].join(' ')
super
end
|
#program_name ⇒ Object
45
46
47
|
# File 'lib/nehm/commands/search_command.rb', line 45
def program_name
'nehm search'
end
|
#summary ⇒ Object
49
50
51
52
|
# File 'lib/nehm/commands/search_command.rb', line 49
def summary
'Search tracks, print them nicely and download, set tags and add ' \
'to iTunes selected'
end
|
#usage ⇒ Object
54
55
56
|
# File 'lib/nehm/commands/search_command.rb', line 54
def usage
"#{program_name} QUERY [OPTIONS]"
end
|