summaryrefslogtreecommitdiff
path: root/cliff/formatters/shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'cliff/formatters/shell.py')
-rw-r--r--cliff/formatters/shell.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cliff/formatters/shell.py b/cliff/formatters/shell.py
index 385d48c..fd4f29e 100644
--- a/cliff/formatters/shell.py
+++ b/cliff/formatters/shell.py
@@ -3,6 +3,8 @@
from .base import SingleFormatter
+import six
+
class ShellFormatter(SingleFormatter):
@@ -34,6 +36,7 @@ class ShellFormatter(SingleFormatter):
desired_columns = parsed_args.variables
for name, value in zip(variable_names, data):
if name in desired_columns or not desired_columns:
- stdout.write('%s%s="%s"\n' % (parsed_args.prefix, name,
- value.replace('"', '\\"')))
+ if isinstance(value, six.string_types):
+ value = value.replace('"', '\\"')
+ stdout.write('%s%s="%s"\n' % (parsed_args.prefix, name, value))
return