summaryrefslogtreecommitdiff
path: root/lib/outputmanager.py
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2012-10-10 18:34:21 -0300
committerRaúl Benencia <rul@kalgan.cc>2012-10-10 18:34:21 -0300
commit7ef52c68574b54333c44c5be739049deac3a28ec (patch)
treed86418475ecaf17087a40c90a26c31519b770e5c /lib/outputmanager.py
parentb3fcf3b4e9dc49b0736e8ba1dfdab2e225999c6d (diff)
Data loader
Diffstat (limited to 'lib/outputmanager.py')
-rw-r--r--lib/outputmanager.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/outputmanager.py b/lib/outputmanager.py
new file mode 100644
index 0000000..d9d4af1
--- /dev/null
+++ b/lib/outputmanager.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python3
+import sys
+
+class OutputManager:
+ def __init__(self):
+
+ self.echo_output = True
+
+ def line_break(self):
+ if self.echo_output:
+ sys.stdout.write('\n')
+ sys.stdout.flush()
+
+ return self
+
+ def error(self, string):
+ if self.echo_output:
+ self._erase_line()
+ string = '[-] ' + string
+ self.last_line_length = len(string)
+
+ sys.stdout.write(string)
+ sys.stdout.flush()
+
+ return self
+
+ def normal(self, string):
+ if self.echo_output:
+ self._erase_line()
+ self.last_line_length = len(string)
+ sys.stdout.write(string)
+ sys.stdout.flush()
+
+ return self
+
+ def _erase_line(self):
+ sys.stdout.write('\r' + ' ' * self.last_line_length + '\r')
+ return self
+
+
+
nihil fit ex nihilo