Prefer the virtualenv version of a tool, if available
- ID
27eb88a- date
2024-01-17 12:38:29+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
e285801- message
Prefer the virtualenv version of a tool, if available- changed files
1 file, 10 additions, 1 deletion
Changed files
config.fish (5919) → config.fish (6249)
diff --git a/config.fish b/config.fish
index 3f53bdf..d65264e 100644
--- a/config.fish
+++ b/config.fish
@@ -146,7 +146,16 @@ end
function __create_python_module_alias
set module_name $argv[1]
- eval "alias $module_name=\"~/repos/scripts/.venv/bin/$module_name\""
+ # If we're in a virtualenv where this module is installed, we
+ # should prefer the virtualenv version over the version in scripts.
+ function $module_name --inherit-variable module_name
+ if test -n (which $module_name)
+ set executable (which $module_name)
+ $executable $argv
+ else
+ ~/repos/scripts/.venv/bin/$module_name $argv
+ end
+ end
end
__create_bash_script_alias flickr/flapi.sh