]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/rm/rm_dummy_runner.rb
Overhaul everything to get consistent error reports.
[mailshears.git] / lib / rm / rm_dummy_runner.rb
index 477608f8e77318e535ef671eca0bb7a629a5d0ad..2ab25e80a3e402f5ba3c21214b30a768d6c2cd2c 100644 (file)
@@ -5,13 +5,18 @@ class RmDummyRunner
 
   def run(plugin, *targets)
     targets.each do |target|
-      if target.include?('@') then
-        user_description = plugin.describe_user(target)
-        report(plugin, "Would remove user: #{target} (#{user_description})")
-      else
-        domain_description = plugin.describe_domain(target)
-        report(plugin, "Would remove domain: #{target} (#{domain_description})")
+      target_description = plugin.describe(target)
+      msg =  "Would remove #{target.class.to_s().downcase()} #{target}"
+
+      # Only append the extra description if it's useful.
+      if not target_description.nil? and
+         not target_description.empty? and
+         not target_description == target.to_s() then
+        msg += " (#{target_description})"
       end
+      msg += '.'
+
+      report(plugin, msg)
     end
 
   end