'Set a configuration parameter'

@util.charconvert
def do_set(self, input):

    plugin = self.get_active_plugin()
    inputList = input.strip().split()
    if (not inputList):
        args = {'title': plugin.getName(), 'vars': plugin.getParameters(hidden=False)}
        self.io.print_set_names(args)
    elif (len(inputList) == 1):
        param = plugin.getParameter(inputList[0])
        try:
            attribList = param.getAttributeList()
            self.io.print_set_attributes(plugin.getName(), inputList[0], attribList)
            if plugin.isParamchoice(inputList[0]):
                attribVal = param.getAttributeValueList()
                self.io.print_set_choices(attribVal)
        except AttributeError:
            raise exception.CmdErr, 'set    [param]    [value]'
    elif (len(input) >= 2):
        set_value = '    '.join(inputList[1:])
        plugin.set(inputList[0], set_value, globalvars=self.fb.fbglobalvars)
        self.io.print_success(('Set    %s    =>    %s' % (inputList[0], truncate(set_value))))
