mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 13:27:10 -07:00
Refactoring: bash calling in its own function.
Also:
- Fixes Travis build reg. bf13d2f
.
- Wrapper test now cleans up after itself.
This commit is contained in:
parent
bf13d2fee1
commit
e01e9a4bea
3 changed files with 13 additions and 4 deletions
|
@ -10,7 +10,7 @@ install:
|
||||||
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
|
- mkdir -p "${HOME}"/.config/fish/{completions,conf.d,functions}
|
||||||
- cp completions/* "${HOME}"/.config/fish/completions/
|
- cp completions/* "${HOME}"/.config/fish/completions/
|
||||||
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
|
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
|
||||||
#- cp functions/* "${HOME}"/.config/fish/functions/
|
- cp functions/* "${HOME}"/.config/fish/functions/
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
|
|
@ -5,14 +5,16 @@ if not test -f "$sdkman_init"
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Declare the sdk command for fish
|
# Runs the given command in bash, capturing some side effects
|
||||||
function sdk -d "Manage SDKs"
|
# and repeating them on the current fish shell.
|
||||||
|
# Returns the same status code as the given command.
|
||||||
|
function __fish_sdkman_run_in_bash
|
||||||
# We need to leave stdin and stdout of sdk free for user interaction.
|
# We need to leave stdin and stdout of sdk free for user interaction.
|
||||||
# So, pipe PATH (which might have changed) through a file.
|
# So, pipe PATH (which might have changed) through a file.
|
||||||
# Now, getting the exit code of sdk itself is a hassle so pipe it as well.
|
# Now, getting the exit code of sdk itself is a hassle so pipe it as well.
|
||||||
# TODO: Can somebody get this to work without the overhead of a file?
|
# TODO: Can somebody get this to work without the overhead of a file?
|
||||||
set pipe (mktemp)
|
set pipe (mktemp)
|
||||||
bash -c "source $sdkman_init && sdk $argv; echo -e \"\$PATH\n\$?\" > $pipe"
|
bash -c "$argv[1]; echo -e \"\$PATH\n\$?\" > $pipe"
|
||||||
set bashDump (cat $pipe; rm $pipe)
|
set bashDump (cat $pipe; rm $pipe)
|
||||||
|
|
||||||
set bashPath $bashDump[1]
|
set bashPath $bashDump[1]
|
||||||
|
@ -24,4 +26,9 @@ function sdk -d "Manage SDKs"
|
||||||
end
|
end
|
||||||
|
|
||||||
return $sdkStatus
|
return $sdkStatus
|
||||||
|
end
|
||||||
|
|
||||||
|
# Declare the sdk command for fish
|
||||||
|
function sdk -d "Manage SDKs"
|
||||||
|
__fish_sdkman_run_in_bash "source $sdkman_init && sdk $argv"
|
||||||
end
|
end
|
|
@ -39,6 +39,8 @@ for sdk_cmd in $test_commands
|
||||||
echo ""
|
echo ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rm {sout, status, path}_{bash, fish}
|
||||||
|
|
||||||
echo "Ran $test_count commands with 3 checks each."
|
echo "Ran $test_count commands with 3 checks each."
|
||||||
echo "$failures/$check_count checks failed."
|
echo "$failures/$check_count checks failed."
|
||||||
exit (math $failures != 0)
|
exit (math $failures != 0)
|
Loading…
Add table
Add a link
Reference in a new issue