fix err: 1 arg missing corner case

This commit is contained in:
viogq 2019-09-18 14:23:36 +00:00 committed by GitHub
parent 09d1feab80
commit d1c63b6517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -225,11 +225,13 @@ class EditConf(Grammar):
conffile = self[1]
options = []
eq = "="
if self[3] and "-s" in self[3].string: eq = " " ## try except # else err
for opt in re.split("\s+", self[4].string):
k, v = opt.split("=", 1)
if self[3] and "-s" in self[3].string: eq = " "
try:
for opt in re.split("\s+", self[4].string):
k, v = opt.split("=", 1) # try except , else err: 1 arg missing
v = re.sub(r"\n+", "", fixup_tokens(v)) # not sure why newlines are getting doubled
options.append("%s%s%s" % (k, eq, v))
except: pass
return "<div class='write-to'><div class='filename'>" + self[1].string + " <span>(change settings)</span></div><pre>" + "\n".join(cgi.escape(s) for s in options) + "</pre></div>\n"
class CaptureOutput(Grammar):