Fix issues with /mhf spell --list. (as reported in daily bug report email)

Mere [06-30-13 - 11:16]
Fix issues with /mhf spell --list.  (as reported in daily bug report email)
Filename
CommandLine.lua
Spells.lua
diff --git a/CommandLine.lua b/CommandLine.lua
index a3488e3..07a0048 100644
--- a/CommandLine.lua
+++ b/CommandLine.lua
@@ -159,17 +159,7 @@ function MereHealingFrames.Commands.Spells(params)

 	if (getOptParams.list) then
 		print("Listing current spell set")
-		for button, modifiers in pairs(MereHealingFrames.CurrentSpellSet) do
-			for modifier, cast in pairs(modifiers) do
-				if cast.spell then
-					print (button .. ": [" .. modifier .. "] " .. cast.spell)
-				elseif cast.target then
-					print (button .. ": [" .. modifier .. "] target")
-				elseif cast.custom then
-					print (button .. ": [" .. modifier .. "] custom: " .. cast.custom)
-				end
-			end
-		end
+        MereHealingFrames.Spells.printSpellSet(MereHealingFrames.CurrentSpellSet)
 		return
 	elseif (getOptParams.button) then
 		local spellSetName = getOptParams.name
diff --git a/Spells.lua b/Spells.lua
index 78c03bd..eec90ee 100644
--- a/Spells.lua
+++ b/Spells.lua
@@ -275,6 +275,33 @@ function MereHealingFrames.Spells.CreateCastMacro(cast, unitId, modifier)
 	return ""
 end

+function MereHealingFrames.Spells.printSpellSet(spellSet)
+    for button, val in pairs(ValidButtons) do
+        local buttonSet = spellSet[button]
+        if (buttonSet) then
+            local printedSomething = false
+            for modifier, cast in pairs(buttonSet) do
+                if cast then
+                    if cast.spell then
+                        print (button .. ": [" .. modifier .. "] " .. cast.spell)
+                        printedSomething = true
+                    elseif cast.target then
+                        print (button .. ": [" .. modifier .. "] target")
+                        printedSomething = true
+                    elseif cast.custom then
+                        print (button .. ": [" .. modifier .. "] custom: " .. cast.custom)
+                        printedSomething = true
+                    end
+                end
+            end
+            if (not printedSomething) then
+                print(button .. ": nothing configured");
+            end
+        else
+            print(button .. ": nothing configured");
+        end
+   end
+end

 function MereHealingFrames.Spells.CreateMagicMere()
 	MereHealingFrames.SpellSets = {}