Class: ListTool::App::AddListCommand
- Inherits:
-
Command
- Object
- Command
- ListTool::App::AddListCommand
show all
- Defined in:
- lib/list_tool/app/commands/add_list_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
20
21
22
|
# File 'lib/list_tool/app/commands/add_list_command.rb', line 20
def execute options, lister
raise(RuntimeError, "list creation failed") if lister.add_list(options[:name]).nil?
end
|
.help ⇒ Object
24
25
26
|
# File 'lib/list_tool/app/commands/add_list_command.rb', line 24
def help
" al, add-list NAME\t\tCreate list with NAME"
end
|
.match?(arg) ⇒ Boolean
7
8
9
|
# File 'lib/list_tool/app/commands/add_list_command.rb', line 7
def match? arg
['al', 'add-list'].include? arg
end
|
.parse(argv) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/list_tool/app/commands/add_list_command.rb', line 11
def parse argv
fail_if_not_an_array(argv)
name = argv.shift
ensure_existence_of("list name" => name)
{name: name}
end
|