vxgmichel/aioconsole

Allow quoting of multi-word arguments with AsynchronousCli

Terrance opened this issue · 3 comments

Currently args is built as a space-separated list of arguments:

@asyncio.coroutine
def runsource(self, source, filename=None):
# Parse the source
if source.strip().endswith('\\'):
return True
source = source.replace('\\\n', '')
try:
name, *args = source.split()
except ValueError:
return False

It would be useful to quote arguments containing spaces so they're treated as one arg, particularly given argparse usually applies to shell args. shlex.split(source) could be a drop-in replacement, though it potentially breaks any usage of unmatched quotes in arguments (which would now raise ValueError).

@OllieTerrance Very good point!

You can either submit a PR and I'll merge it right away, or I'll take care of it during the week. I can also make a new release if need one.

Thanks for the report!

I've plugged the fork in for now, so no rush for a release. 🙂

Great, thank you very much! (will become visible with v0.1.8)