docs: add docs for script args, fix #293

This commit is contained in:
Maximilian Hils
2014-08-07 01:30:47 +02:00
parent 74b801ba08
commit c6911a4158
3 changed files with 29 additions and 14 deletions

View File

@@ -55,10 +55,12 @@ class Script:
@classmethod
def parse_command(klass, command):
args = shlex.split(command, posix=(os.name != "nt"))
args = shlex.split(command)
args[0] = os.path.expanduser(args[0])
if not os.path.exists(args[0]):
raise ScriptError("Command not found.")
raise ScriptError(("Script file not found: %s.\r\n"
"If you script path contains spaces, "
"make sure to wrap it in additional quotes, e.g. -s \"'./foo bar/baz.py' --args\".") % args[0])
elif not os.path.isfile(args[0]):
raise ScriptError("Not a file: %s" % args[0])
return args