36 lines
586 B
Python
36 lines
586 B
Python
global commandToList
|
|
def commandToList(cmd):
|
|
args = []
|
|
cArg = ""
|
|
escape = False
|
|
for letter in cmd:
|
|
if escape == True:
|
|
cArg += letter
|
|
escape = False
|
|
continue
|
|
|
|
if letter == "\\":
|
|
escape = True
|
|
continue
|
|
|
|
if letter == ",":
|
|
if cArg == "": continue
|
|
args.append(cArg)
|
|
cArg = ""
|
|
continue
|
|
|
|
cArg += letter
|
|
|
|
args.append(cArg)
|
|
|
|
return args
|
|
|
|
global listToCommand
|
|
def listToCommand(lst):
|
|
cmd = ""
|
|
for arg in lst:
|
|
arg = arg.replace("\\","\\\\")
|
|
arg = arg.replace(",","\\,")
|
|
cmd += arg + ","
|
|
|
|
return cmd[:-1] |