diff --git a/lib/boom/command.rb b/lib/boom/command.rb index 9516ac0..6a4c5d2 100644 --- a/lib/boom/command.rb +++ b/lib/boom/command.rb @@ -108,12 +108,12 @@ def delegate(command, major, minor) end end - return search_items(command) if storage.item_exists?(command) - if minor == 'delete' and storage.item_exists?(major) return delete_item(command, major) end + return search_items(command) if storage.item_exists?(command) + return create_list(command, major, stdin.read) if !minor && stdin.stat.size > 0 return create_list(command, major, minor) end diff --git a/test/test_command.rb b/test/test_command.rb index d757af9..6a67142 100644 --- a/test/test_command.rb +++ b/test/test_command.rb @@ -220,4 +220,14 @@ def test_delete_item_wrong_list assert_match /github not found in urlz/, command('urlz github delete') end + def test_delete_item_different_name + command('foo bar baz') + assert_match /bar is gone forever/, command('foo bar delete') + end + + def test_delete_item_same_name + command('duck duck goose') + assert_match /duck is gone forever/, command('duck duck delete') + end + end