From 17b21446ae60ac83d1a4df93695a235f6cee8056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Wed, 29 Jun 2016 14:56:05 +0200 Subject: [PATCH 1/2] [options] Accept quoted string across multiple lines (#9940) Like: -f " bestvideo+bestaudio/ best " --- youtube_dl/options.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 99ce4131f..c9033e3cb 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -26,9 +26,7 @@ def parseOpts(overrideArguments=None): except IOError: return default # silently skip if file is not present try: - res = [] - for l in optionf: - res += compat_shlex_split(l, comments=True) + res = compat_shlex_split(optionf.read(), comments=True) finally: optionf.close() return res From 3a7e7ed55c3b6d0babde5740aa3a0c1979d16339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Wed, 29 Jun 2016 18:54:30 +0200 Subject: [PATCH 2/2] [test/compat] compat_shlex_split: test with newlines --- test/test_compat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_compat.py b/test/test_compat.py index f5317ac3e..1d7ac9f16 100644 --- a/test/test_compat.py +++ b/test/test_compat.py @@ -87,6 +87,7 @@ class TestCompat(unittest.TestCase): def test_compat_shlex_split(self): self.assertEqual(compat_shlex_split('-option "one two"'), ['-option', 'one two']) + self.assertEqual(compat_shlex_split('-option "one\ntwo" \n -flag'), ['-option', 'one\ntwo', '-flag']) def test_compat_etree_fromstring(self): xml = '''