Class: ListTool::App::DeleteListCommand
- Inherits:
-
Object
- Object
- ListTool::App::DeleteListCommand
- Defined in:
- lib/list_tool/app/commands/delete_list_command.rb
Class Method Summary collapse
Class Method Details
.execute(options, lister) ⇒ Object
21 22 23 |
# File 'lib/list_tool/app/commands/delete_list_command.rb', line 21 def self.execute , lister raise(ListNotFoundError, 'no list with given number') if lister.delete_list([:list]).nil? end |
.help ⇒ Object
25 26 27 |
# File 'lib/list_tool/app/commands/delete_list_command.rb', line 25 def self.help " dl, del-list LIST\t\tDelete given LIST" end |
.match?(arg) ⇒ Boolean
6 7 8 |
# File 'lib/list_tool/app/commands/delete_list_command.rb', line 6 def self.match? arg ['dl', 'del-list'].include? arg end |
.parse(argv) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/list_tool/app/commands/delete_list_command.rb', line 10 def self.parse argv raise ArgumentError, "expected argument to be an array, #{argv.class} given" unless argv.is_a? Array list = argv.shift raise ArgumentError, 'list number not specified' if list.nil? list = Integer(list) - 1 rescue raise(ArgumentError, 'list number must be an integer') raise ArgumentError, "list number can't be less than 1" if list < 0 {list: list} end |