aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules/commands/outs.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-12-10 05:27:35 +0000
committerGravatar jesopo2019-12-10 05:27:35 +0000
commit638eee0d685c06d258cb55287204ca97bca7c344 (patch)
tree33442439317ae2846f1efb7674b7a3758c8990a1 /src/core_modules/commands/outs.py
parentmove sys.exit() codes to an enum in utils.consts (diff)
signature
move core modules to src/core_modules, make them uneffected by white/black list
Diffstat (limited to 'src/core_modules/commands/outs.py')
-rw-r--r--src/core_modules/commands/outs.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core_modules/commands/outs.py b/src/core_modules/commands/outs.py
new file mode 100644
index 00000000..e82ceefd
--- /dev/null
+++ b/src/core_modules/commands/outs.py
@@ -0,0 +1,28 @@
+import re
+from src import IRCLine, utils
+
+class StdOut(object):
+ def __init__(self, prefix):
+ self.prefix = prefix
+ self._lines = []
+ self._assured = False
+
+ def assure(self):
+ self._assured = True
+
+ def write(self, text):
+ self.write_lines(
+ text.replace("\r", "").replace("\n\n", "\n").split("\n"))
+ def write_lines(self, lines):
+ self._lines += list(filter(None, lines))
+
+ def get_all(self):
+ return self._lines.copy()
+ def pop(self):
+ return self._lines.pop(0)
+ def insert(self, text):
+ self._lines.insert(0, text)
+
+ def has_text(self):
+ return bool(self._lines)
+