aboutsummaryrefslogtreecommitdiff
path: root/src/hooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks.py')
-rw-r--r--src/hooks.py36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/hooks.py b/src/hooks.py
index 01319d1..8439c0a 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/10/06 09:12:52 by cacharle ### ########.fr #
+# Updated: 2020/10/07 08:27:49 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -57,15 +57,41 @@ def replace_double_semi_colon(output):
return output.replace(";;", ";")
-def platform_exit_status(darwin_status, linux_status, windows_status=None):
+def platform_status(darwin_status, linux_status, windows_status=None):
def hook(status):
- name = os.uname().sysname
- if name == "Darwin":
+ if config.PLATFORM == "Darwin":
return status
- elif name == "Linux":
+ elif config.PLATFORM == "Linux":
return (darwin_status if status == linux_status else status)
else:
raise RuntimeError("This platform exit codes are not supported yet,"
"feel free to contact me to add it.")
sys.exit(2)
return status
+ return hook
+
+
+def is_directory(output):
+ if config.PLATFORM == "Linux":
+ return output.replace("Is a directory", "is a directory")
+ else:
+ return output
+
+
+# def no_cd_too_many_arguments(output):
+# for i, line in output.split("\n"):
+# if line.find("too many arguments")
+
+
+def shlvl_0_to_1(output):
+ if config.PLATFORM == "Linux":
+ return output.replace("SHLVL=0", "SHLVL=1")
+ else:
+ return output
+
+
+def delete_escape(output):
+ if config.PLATFORM == "Linux":
+ return output.replace("\\", "")
+ else:
+ return output