diff --git a/core/app.py b/core/app.py index d6df228..dd68a4a 100644 --- a/core/app.py +++ b/core/app.py @@ -17,9 +17,10 @@ prefix = textui.prefix # -------------------------------------------------- def _parse(data, dtype): + print('### called _parse(%s, %s)' %(repr(data), repr(dtype))) if dtype == 'str': - if data.startswith('\'') and data.endswith('\''): - value = data[1:-1].replace('\\\'', '\'') + if data.startswith('"') and data.endswith('"'): + value = data[1:-1].replace('\\"', '"') else: raise RuntimeError diff --git a/core/cmd.py b/core/cmd.py index f3ef5e0..a7d04d5 100644 --- a/core/cmd.py +++ b/core/cmd.py @@ -19,6 +19,13 @@ def capture_output(stream, fifo): stream.close() +def char_in_str(chars, string): + for char in chars: + if char in string: + return True + + return False + class Command: ''' A shell command with argument substitution and output capture. @@ -75,7 +82,7 @@ class Command: out.append(str(item)) 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: return out