aboutsummaryrefslogtreecommitdiff
path: root/src/hooks.py
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-11 22:20:15 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-11 22:20:15 +0200
commit958c410ba8b621a8a4d8caf04012028e7f151e0f (patch)
treee63465450b581afd2b631510e00b643efc5af9e7 /src/hooks.py
parent2ffd95c295b117053f6e5430ba3ccc72beb224aa (diff)
downloadminishell_test-958c410ba8b621a8a4d8caf04012028e7f151e0f.tar.gz
minishell_test-958c410ba8b621a8a4d8caf04012028e7f151e0f.tar.bz2
minishell_test-958c410ba8b621a8a4d8caf04012028e7f151e0f.zip
Added comments
Diffstat (limited to 'src/hooks.py')
-rw-r--r--src/hooks.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hooks.py b/src/hooks.py
index 7582c6e..770aca8 100644
--- a/src/hooks.py
+++ b/src/hooks.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 16:10:20 by charles #+# #+# #
-# Updated: 2020/09/11 19:53:43 by charles ### ########.fr #
+# Updated: 2020/09/11 22:11:21 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -16,10 +16,12 @@ import config
def sort_lines(output):
+ """Sort lines of output"""
return '\n'.join(sorted(output.split('\n')))
def error_line0(output):
+ """Replace "/bin/bash: -c: line 0:" by "minishell:" and delete the second line"""
lines = output.split('\n')
if len(lines) != 3:
return output
@@ -30,10 +32,12 @@ def error_line0(output):
def discard(output):
+ """Discard the output"""
return "DISCARDED BY TEST"
def export_singleton(output):
+ """Remove variable that are not set to anything in a call to export without arguments"""
return sort_lines(
'\n'.join([line for line in output.split('\n')
if regex.match("^declare -x .+=\".*\"$", line) is not None])