Class: Vnehm::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
23
|
# File 'lib/vnehm/commands/search_command.rb', line 7
def initialize
super
add_option(:"-t", '-t ПУТЬ',
'Скачивать аудиозапись(и) в ПУТЬ')
add_option(:"-pl", '-pl ПЛЕЙЛИСТ',
"Добавлять аудиозапись(и) в плейлист iTunes'a c именем" \
' ПЛЕЙЛИСТ')
add_option(:"-lim", '-lim ЧИСЛО',
'Показывать ЧИСЛО аудиозаписей на каждой страницe')
add_option(:"-dl", '-dl yes',
'Не добавлять аудиозаписи в iTunes. Просто скачать их')
end
|
Instance Method Details
#arguments ⇒ Object
42
43
44
|
# File 'lib/vnehm/commands/search_command.rb', line 42
def arguments
{ 'ЗАПРОС' => 'Искать аудиозаписи по ЗАПРОСу' }
end
|
#execute ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/vnehm/commands/search_command.rb', line 25
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
46
47
48
|
# File 'lib/vnehm/commands/search_command.rb', line 46
def program_name
'vnehm search'
end
|
#summary ⇒ Object
50
51
52
|
# File 'lib/vnehm/commands/search_command.rb', line 50
def summary
'Поиск, вывод и загрузка определенных аудиозаписей по запросу'
end
|
#usage ⇒ Object
54
55
56
|
# File 'lib/vnehm/commands/search_command.rb', line 54
def usage
"#{program_name} ЗАПРОС [ОПЦИИ]"
end
|