command = {
name = 'short name',
desc = 'long description',
type = 'execute',
set = "MethodName",
}
-- /addon command -- calls MethodName()
command = {
name = 'short name',
desc = 'long description',
type = 'set',
values = { 'one', 'two', 'three' },
get = "GetterMethod",
set = "SetterMethod",
}
-- /addon command -- prints out Usage: {one || two || three}, current value: `GetterMethod()`
-- /addon command one -- calls SetterMethod('one'), prints out short name now set to [one]
command = {
name = 'short name',
desc = 'long description',
type = 'text',
usage = "name of that guy",
get = "GetterMethod", -- optional
set = "SetterMethod",
validate = function(x) return true end, -- optional, a false return means an error.
}
-- /addon command -- print out Usage: {name of that guy}, current value `GetterMethod()`
-- /addon command Humphrey -- calls validate("Humphrey"), passes. calls SetterMethod("Humphrey"). prints out short name now set to [Humphrey]
command = {
name = 'short name',
desc = 'long description',
type = 'range',
start = 0 -- optional, 0 default
end = 1 -- optional, 1 default
isPercent = true -- optional, false default
get = "GetterMethod",
set = "SetterMethod",
}
-- /addon command -- print out Usage: {0-100}, current value `GetterMethod()*100` -- percentage makes things *100
-- /addon command 50 -- calls SetterMethod(50/100), prints out short name is now set to [50%]
command = {
name = 'short name',
desc = 'long description',
type = 'toggle',
get = "GetterMethod",
set = "SetterMethod", -- this can be a toggle method, but the new true/false value will be passed in anyway.
}
-- /addon command -- calls SetterMethod(not GetterMethod()). prints out short name isnow set to [On]
command = {
name = 'short name',
desc = 'long description',
type = 'color',
get = "GetterMethod", -- returns r, g, b [, a]
set = "SetterMethod", -- takes r, g, b [, a]
hasAlpha = true, -- optional, default false
}
-- /addon command -- pops up a shiny color picker. when color changes, SetterMethod(r,g,b,a) is called. When OK is pressed, it prints out the new color.
command = {
name = 'short name',
desc = 'long description',
type = 'pass',
passType = 'text'
get = "GetterMethod", -- optional, depending on passType
set = "SetterMethod",
args = {
one = { -- calling this would call SetterMethod('one', ...)
name = 'other short name',
desc = 'long description',
usage = 'some text'
},
two = {
name = 'short name',
desc = 'long description',
},
}
}
-- /addon command -- prints out Usage: {one || two}
-- /addon command one -- prints out Usage: {some text} Current value: `GetterMethod('one')`.
-- /addon command one test -- calls SetterMethod('test'). prints out other short name is now set to [test].
command = {
name = 'short name',
desc = 'long description',
type = 'group', -- optional, group is default
args = {
one = {
-- fully formed command
},
two = {
-- fully formed command
},
}
}
-- /addon command -- prints out Usage: {one || two}
-- /addon command one -- goes to the one command, runs through that.