def cmdLine(useBasename=False):
    """Return full command line with any necessary quoting."""
    qargv = []
    cmdwords = list(sys.argv)
    if useBasename:
        cmdwords[0] = os.path.basename(cmdwords[0])
    for s in cmdwords:
        # any white space or special characters in word so we need quoting?
        if re.search(r'\s|\*|\?', s):
            if "'" in s:
                qargv.append('"%s"' % re.sub('"', "'", s))
            else:
                qargv.append("'%s'" % re.sub("'", '"', s))
        else:
            qargv.append(s)
    cmd = ' '.join(qargv)
    return cmd
def cmdLine ( useBasename = False ) : qargv = [ ] cmdwords = list ( sys . argv ) if useBasename : cmdwords [ 0 ] = os . path . basename ( cmdwords [ 0 ] ) for s in cmdwords : if re . search ( r'\s|\*|\?' , s ) : if "'" in s : qargv . append ( '"%s"' % re . sub ( '"' , "'" , s ) ) else : qargv . append ( "'%s'" % re . sub ( "'" , '"' , s ) ) else : qargv . append ( s ) cmd = ' ' . join ( qargv ) return cmd
Return full command line with any necessary quoting.