1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-19 19:01:03 +00:00

Properly recompose/split command line

Fixes #161
This commit is contained in:
Alban Féron 2019-08-24 17:40:48 +02:00
parent 3e845f2f81
commit 9dd7d8a58b
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -10,6 +10,8 @@
import argparse
import cmd
import getpass
import pipes # replace by shlex once Python 2.7 supprt is dropped
import shlex
import sys
import time
@ -55,7 +57,7 @@ class SupysonicCLI(cmd.Cmd):
def _make_do(self, command):
def method(obj, line):
try:
args = getattr(obj, command + "_parser").parse_args(line.split())
args = getattr(obj, command + "_parser").parse_args(shlex.split(line))
except RuntimeError as e:
self.write_error_line(str(e))
return
@ -405,7 +407,7 @@ def main():
cli = SupysonicCLI(config)
if len(sys.argv) > 1:
cli.onecmd(" ".join(sys.argv[1:]))
cli.onecmd(" ".join(pipes.quote(arg) for arg in sys.argv[1:]))
else:
cli.cmdloop()