import shlex


def type_shell_split(string):
    """
    Parse and split shell arguments string into a list of shell arguments.

    Recognize `,` as a separator as well as white spaces.
    string: -BAR="foo bar" -BAZ='foo,bar',-QUX 42
    into
    ['-BAR=foo bar', '-BAZ=foo,bar', "-QUX", "42"]
    """
    lex = shlex.shlex(string, posix=True)
    lex.whitespace_split = True
    lex.whitespace += ','
    return list(lex)