Class: ListTool::App::ShowItemsCommand
- Inherits:
-
Command
- Object
- Command
- ListTool::App::ShowItemsCommand
show all
- Defined in:
- lib/list_tool/app/commands/show_items_command.rb
Class Method Summary
collapse
Methods inherited from Command
ensure_existence_of, fail_if_not_an_array, parse_item_number, parse_item_number!, parse_list_number, parse_list_number!, parse_number
Class Method Details
.execute(options, lister) ⇒ Object
19
20
21
22
23
|
# File 'lib/list_tool/app/commands/show_items_command.rb', line 19
def execute options, lister
items = options[:list].nil? ? lister.list() : lister.list(options[:list])
raise ListNotFoundError if items.nil?
Printer.print_items( items )
end
|
.help ⇒ Object
25
26
27
|
# File 'lib/list_tool/app/commands/show_items_command.rb', line 25
def help
" s, show-items [LIST]\t\tPrint contents of default or given list"
end
|
.match?(arg) ⇒ Boolean
7
8
9
|
# File 'lib/list_tool/app/commands/show_items_command.rb', line 7
def match? arg
['s', 'show-items'].include? arg
end
|
.parse(argv) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/list_tool/app/commands/show_items_command.rb', line 11
def parse argv
fail_if_not_an_array(argv)
list = argv.shift
list ? {list: parse_list_number(list)} : {}
end
|