Last active
January 19, 2017 00:11
-
-
Save nalipaz/a8730ea349855f5ba871db90492f58c7 to your computer and use it in GitHub Desktop.
Make direnv do function aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export_alias() { | |
local name=$1 | |
local alias_dir=$PWD/.direnv/aliases | |
mkdir -p "$alias_dir" | |
PATH_add "$alias_dir" | |
local target="$alias_dir/$name" | |
if declare -f "$name" >/dev/null; then | |
echo "#!/usr/bin/env bash" > "$target" | |
declare -f "$name" >> "$target" 2>/dev/null | |
echo "$@" >> "$target" | |
chmod +x "$target" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment