summaryrefslogtreecommitdiffstats
path: root/formats/string_iter.py
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-04-15 13:04:36 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-04-15 15:26:18 +0200
commit9ed0f365be54eae2f817be16a8422a13c07ac2dd (patch)
tree80214630f48f1d7d6888c8473fcbd952c88fceb8 /formats/string_iter.py
parent5231e45ddfcd28cd507a987739f65db6373dbbc1 (diff)
downloadclufter-9ed0f365be54eae2f817be16a8422a13c07ac2dd.tar.gz
clufter-9ed0f365be54eae2f817be16a8422a13c07ac2dd.tar.xz
clufter-9ed0f365be54eae2f817be16a8422a13c07ac2dd.zip
formats/string_iter: (always for now) add a trailing newline
First, it's a convention, second, it looks way better when outputting the list on stdout (line is not interleaved with subsequent shell prompt). Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'formats/string_iter.py')
-rw-r--r--formats/string_iter.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/formats/string_iter.py b/formats/string_iter.py
index 20e42ba..8984d1e 100644
--- a/formats/string_iter.py
+++ b/formats/string_iter.py
@@ -1,5 +1,5 @@
# -*- coding: UTF-8 -*-
-# Copyright 2014 Red Hat, Inc.
+# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Format representing a list of strings (new-line delimited)"""
@@ -17,7 +17,11 @@ class string_iter(SimpleFormat):
def get_bytestring(self, *protodecl):
"""Return command as canonical single string"""
# chained fallback
- return '\n'.join(s for s in self.STRINGITER(protect_safe=True) if s)
+ return (
+ # add a trailing new-line as per conventions
+ # XXX should there be a knob for that?
+ '\n'.join(s for s in self.STRINGITER(protect_safe=True) if s) + '\n'
+ )
@SimpleFormat.producing(STRINGITER, protect=True)
def get_stringiter(self, *protodecl):