From 59cffbf3ebd458442d79fa49972035dde1e479bb Mon Sep 17 00:00:00 2001 From: nishiki Date: Sun, 8 Sep 2013 18:02:10 +0200 Subject: [PATCH] no show an void item if the item doesn't exist --- lib/Cli.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Cli.rb b/lib/Cli.rb index ee3721f..1f49887 100644 --- a/lib/Cli.rb +++ b/lib/Cli.rb @@ -164,11 +164,15 @@ class Cli if not force result = @m.searchById(id) - displayFormat(result) + if result.length > 0 + displayFormat(result) - confirm = ask("Are you sure to remove the item: #{id} ? (y/N) ") - if confirm =~ /^(y|yes|YES|Yes|Y)$/ - force = true + confirm = ask("Are you sure to remove the item: #{id} ? (y/N) ") + if confirm =~ /^(y|yes|YES|Yes|Y)$/ + force = true + end + else + puts "Nothing result!" end end