- fixed cfg file parsing for strings
- fixes in over.core.cmd
This commit is contained in:
parent
e71cedf58c
commit
f1ada6f32f
2 changed files with 11 additions and 3 deletions
|
@ -17,9 +17,10 @@ prefix = textui.prefix
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
def _parse(data, dtype):
|
def _parse(data, dtype):
|
||||||
|
print('### called _parse(%s, %s)' %(repr(data), repr(dtype)))
|
||||||
if dtype == 'str':
|
if dtype == 'str':
|
||||||
if data.startswith('\'') and data.endswith('\''):
|
if data.startswith('"') and data.endswith('"'):
|
||||||
value = data[1:-1].replace('\\\'', '\'')
|
value = data[1:-1].replace('\\"', '"')
|
||||||
else:
|
else:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,13 @@ def capture_output(stream, fifo):
|
||||||
|
|
||||||
stream.close()
|
stream.close()
|
||||||
|
|
||||||
|
def char_in_str(chars, string):
|
||||||
|
for char in chars:
|
||||||
|
if char in string:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
class Command:
|
class Command:
|
||||||
'''
|
'''
|
||||||
A shell command with argument substitution and output capture.
|
A shell command with argument substitution and output capture.
|
||||||
|
@ -75,7 +82,7 @@ class Command:
|
||||||
out.append(str(item))
|
out.append(str(item))
|
||||||
|
|
||||||
if pretty:
|
if pretty:
|
||||||
return [('"%s"' %(a) if ' ' in a else a) for a in out]
|
return [('"%s"' %(a) if char_in_str(" ()[];\\", a) else a) for a in out]
|
||||||
else:
|
else:
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue