Thanks to this github issue: https://github.com/direnv/direnv/issues/73#issuecomment-1192448475 There is now a possibility to create aliases on fly Signed-off-by: Jeremy MAURO <jeremy.mauro@gmail.com>
@@ -0,0 +1,16 @@
+export_alias() {
+ local name=$1
+ shift
+ local alias_dir=$PWD/.direnv/aliases
+ local target="$alias_dir/$name"
+ local oldpath="$PATH"
+ mkdir -p "$alias_dir"
+ if ! [[ ":$PATH:" == *":$alias_dir:"* ]]; then
+ PATH_add "$alias_dir"
+ fi
+
+ echo "#!/usr/bin/env bash" > "$target"
+ echo "PATH=\"$oldpath\"" >> "$target"
+ echo "$@" >> "$target"
+ chmod +x "$target"
+}