@@ -29,6 +29,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Neuron")
2929local slashFunctions = {
3030 {L [" Menu" ], L [" Menu_Description" ], " ToggleMainMenu" },
3131 {L [" Create" ], L [" Create_Description" ], " CreateNewBar" },
32+ {L [" Select" ], L [" Select_Description" ], " ChangeBar" },
3233 {L [" Delete" ], L [" Delete_Description" ], " DeleteBar" },
3334 {L [" Config" ], L [" Config_Description" ], " ToggleBarEditMode" },
3435 {L [" Add" ], L [" Add_Description" ], " AddObjectsToBar" },
@@ -80,7 +81,7 @@ function Neuron:slashHandler(input)
8081 return
8182 end
8283
83- local commandAndArgs = {strsplit ( " " , input )} -- split the input into the command and the arguments
84+ local commandAndArgs = {Neuron : GetArgs ( input , 3 , 1 )} -- split the input into the command and the arguments
8485 local command = commandAndArgs [1 ]:lower ()
8586 local args = {}
8687 for i = 2 ,# commandAndArgs do
@@ -106,6 +107,21 @@ function Neuron:slashHandler(input)
106107 local func = slashFunctions [i ][3 ]
107108 local bar = Neuron .CurrentBar
108109
110+ if func == " ChangeBar" then -- intercept our bar assignment and reassign to the new bar, if it exists
111+ local newBar
112+ for _ ,v in pairs (Neuron .BARIndex ) do
113+ if v .data .name == args [1 ] then
114+ newBar = v
115+ break
116+ end
117+ end
118+ if newBar then
119+ bar = newBar -- swap out the current bar with the new bar
120+ else
121+ bar = nil -- unassign bar if the entered one doesn't exists
122+ end
123+ end
124+
109125 if Neuron [func ] then
110126 Neuron [func ](Neuron , args [1 ])
111127 elseif bar and bar [func ] then
0 commit comments