def parseCommandLineArguments(cmdLine):
    """Parses command line arguments provided by the user in the UI"""
    result = []
    cmdLine = cmdLine.strip()
    expectQuote = False
    expectDblQuote = False
    lastIndex = len(cmdLine) - 1
    argument = ''
    index = 0
    while index <= lastIndex:
        if expectQuote:
            if cmdLine[index] == "'":
                if cmdLine[index - 1] != '\\':
                    if argument != '':
                        result.append(argument)
                        argument = ''
                    expectQuote = False
                else:
                    argument = argument[:-1] + "'"
            else:
                argument += cmdLine[index]
            index += 1
            continue
        if expectDblQuote:
            if cmdLine[index] == '"':
                if cmdLine[index - 1] != '\\':
                    if argument != '':
                        result.append(argument)
                        argument = ''
                    expectDblQuote = False
                else:
                    argument = argument[:-1] + '"'
            else:
                argument += cmdLine[index]
            index += 1
            continue
        if cmdLine[index] == "'":
            if index == 0 or cmdLine[index - 1] != '\\':
                expectQuote = True
                if argument != '':
                    result.append(argument)
                    argument = ''
            else:
                argument = argument[:-1] + "'"
            index += 1
            continue
        if cmdLine[index] == '"':
            if index == 0 or cmdLine[index - 1] != '\\':
                expectDblQuote = True
                if argument != '':
                    result.append(argument)
                    argument = ''
            else:
                argument = argument[:-1] + '"'
            index += 1
            continue
        if cmdLine[index] in (' ', '\t'):
            if argument != '':
                result.append(argument)
                argument = ''
            index += 1
            continue
        argument += cmdLine[index]
        index += 1
    if argument != '':
        result.append(argument)
    if expectQuote or expectDblQuote:
        raise Exception('No closing quotation')
    return result
