From: Ondrej Lichtner <olichtne@redhat.com>
Very simple implementation of adding space indentation to multiline
strings. Will be used when pretty printing PerfRepo objects.
Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
---
lnst/Common/Utils.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index 22d2925..ceb01a3 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -290,3 +290,9 @@ def is_installed(program):
return True
except subprocess.CalledProcessError:
return False
+
+def indent(string, spaces):
+ ret_str = ""
+ for line in string.split("\n"):
+ ret_str += " "*spaces + line + "\n"
+ return ret_str
--
2.5.2
_______________________________________________
LNST-developers mailing list
LNST-developers@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers