aboutsummaryrefslogtreecommitdiff
path: root/src/hooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks.py')
-rw-r--r--src/hooks.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hooks.py b/src/hooks.py
index b723b99..7ee1334 100644
--- a/src/hooks.py
+++ b/src/hooks.py
@@ -6,16 +6,19 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 16:10:20 by charles #+# #+# #
-# Updated: 2020/09/11 17:06:03 by charles ### ########.fr #
+# Updated: 2020/09/11 18:26:58 by charles ### ########.fr #
# #
# ############################################################################ #
+import regex
+
import config
def sort_lines(output):
return '\n'.join(sorted(output.split('\n')))
+
def error_line0(output):
lines = output.split('\n')
if len(lines) != 3:
@@ -25,5 +28,13 @@ def error_line0(output):
return output
return lines[0].replace(prefix, "minishell: ") + "\n"
+
def discard(output):
return "DISCARDED BY TEST"
+
+
+def export_singleton(output):
+ return sort_lines(
+ '\n'.join([l for l in output.split('\n')
+ if regex.match("^declare -x .+=\".*\"$", l) is not None])
+ )