'Set a global variable'

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

    readonly_globals = ['logdir', 'tmpdir']
    (argc, argv) = util.parseinput(input, 2)
    if (argc in (0, 1)):
        args = {'title': 'Global    Variables', 'vars': self.fbglobalvars.items()}
        self.io.print_set_names(args)
    elif (argc > 1):
        inputList = input.strip().split()
        value = '    '.join(inputList[1:])
        self.fbglobalvars[inputList[0]] = value
        self.io.print_success(('Set    %s    =>    %s' % (inputList[0], value)))
        if (inputList[0].lower() == 'logdir'):
            self.set_logdir(value)
            self.fbglobalvars['TmpDir'] = value
        elif (inputList[0].lower() == 'tmpdir'):
            raise exception.CmdErr, 'TmpDir    is    readonly    and    set    with    LogDir'
        elif (inputList[0].lower() == 'color'):
            self.io.setcolormode((value.lower() == 'true'))
