Use shlex for console parsing.

master
q3k 2012-05-02 16:25:58 +00:00
parent 052ef59e3f
commit fdcde7be8f
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import logic
import sys
import shlex
actions = {
"initialize": (logic.initialize, [], True),
@ -19,7 +20,7 @@ def start():
sys.stdout.write("> ")
sys.stdout.flush()
line = raw_input().strip()
command = line.split()[0]
command = shlex.split(line)[0]
if command == "quit":
break
@ -42,7 +43,7 @@ def start():
print "[e] Make up your mind."
continue
given_arguments = line.split()[1:]
given_arguments = shlex.split(line)[1:]
if len(given_arguments) != len(arguments):
print "[e] Syntax: %s %s" % (command, " ".join([argument[0] for argument in arguments]))
continue