diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-09-11 17:02:40 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-09-11 17:06:19 +0200 |
| commit | 1739695001889d53d29976943fda593d64afcefb (patch) | |
| tree | c42f7a77b99f662712dca4058962f90e480cc39c /src/hooks.py | |
| parent | 39ac257ac326ade708ac54a61957506249ea18e1 (diff) | |
| download | minishell_test-1739695001889d53d29976943fda593d64afcefb.tar.gz minishell_test-1739695001889d53d29976943fda593d64afcefb.tar.bz2 minishell_test-1739695001889d53d29976943fda593d64afcefb.zip | |
Added error_line0 hook
Diffstat (limited to 'src/hooks.py')
| -rw-r--r-- | src/hooks.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/hooks.py b/src/hooks.py index cd165a3..b723b99 100644 --- a/src/hooks.py +++ b/src/hooks.py @@ -6,9 +6,24 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 16:10:20 by charles #+# #+# # -# Updated: 2020/09/11 16:10:51 by charles ### ########.fr # +# Updated: 2020/09/11 17:06:03 by charles ### ########.fr # # # # ############################################################################ # +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: + return output + prefix = "{}: -c: line 0: ".format(config.REFERENCE_PATH) + if lines[0].find(prefix) != 0: + return output + return lines[0].replace(prefix, "minishell: ") + "\n" + +def discard(output): + return "DISCARDED BY TEST" |
