aboutsummaryrefslogtreecommitdiff
path: root/src/hooks.py
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-12 10:40:17 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-12 10:40:17 +0200
commitd66394dc10517af4578e80d626dc903a3cdece79 (patch)
treea37946809fbf728f1aa08c6e02d38b35290b568b /src/hooks.py
parent387fe3441d2f1f02b8ff85e798eb1295f95b7e7f (diff)
downloadminishell_test-d66394dc10517af4578e80d626dc903a3cdece79.tar.gz
minishell_test-d66394dc10517af4578e80d626dc903a3cdece79.tar.bz2
minishell_test-d66394dc10517af4578e80d626dc903a3cdece79.zip
Fixing autocompletion with 0 match, Fixing export singleton with --posix
Diffstat (limited to 'src/hooks.py')
-rw-r--r--src/hooks.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hooks.py b/src/hooks.py
index 770aca8..001b956 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 22:11:21 by charles ### ########.fr #
+# Updated: 2020/09/12 10:37:16 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -38,7 +38,8 @@ def discard(output):
def export_singleton(output):
"""Remove variable that are not set to anything in a call to export without arguments"""
+ prefix = "export " if ("--posix" in config.REFERENCE_ARGS) else "declare -x "
return sort_lines(
'\n'.join([line for line in output.split('\n')
- if regex.match("^declare -x .+=\".*\"$", line) is not None])
+ if regex.match("^{}.+=\".*\"$".format(prefix), line) is not None])
)