Implement autoenv feature.

Closes issue #38
This commit is contained in:
Raphael Reitzig 2021-02-26 17:17:08 +01:00
parent 61f1cf8efc
commit 6dc108ec03
2 changed files with 10 additions and 1 deletions

View file

@ -16,7 +16,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Compatibility with SDKMAN! 5.9.2 - Compatibility with SDKMAN! 5.9.2
- Completions for `env`, `home`, `flush` (issue #35) - Completions for `env`, `home`, `flush` (issue #35)
- Correct behaviour of `env clear`. - Correct behaviour of `env clear`.
- TODO: autoenv (issue #38) - Honor `sdkman_auto_env=true` (issue #38)
- TODO: custom SDKMAN! install path (issue #34) - TODO: custom SDKMAN! install path (issue #34)
- Compatibility with fisher 4 (PR #37, #39) - Compatibility with fisher 4 (PR #37, #39)

View file

@ -83,3 +83,12 @@ if not set -q SDKMAN_DIR; or test (ls -ld "$SDKMAN_DIR" | awk '{print $3}') != (
__fish_sdkman_run_in_bash "source $__fish_sdkman_init" __fish_sdkman_run_in_bash "source $__fish_sdkman_init"
end end
# Set up autoenv
if grep -q "^sdkman_auto_env=true" "$SDKMAN_DIR/etc/config"
function __fish_sdkman_autoenv --on-variable PWD
# Run the (modified) init script, which performs the checks and calls for us!
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\""
set -x SDKMAN_OLD_PWD "$PWD"
end
end