mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -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}
|
||||
- cp completions/* "${HOME}"/.config/fish/completions/
|
||||
- cp conf.d/* "${HOME}"/.config/fish/conf.d/
|
||||
#- cp functions/* "${HOME}"/.config/fish/functions/
|
||||
- cp functions/* "${HOME}"/.config/fish/functions/
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
|
|
@ -5,14 +5,16 @@ if not test -f "$sdkman_init"
|
|||
exit 0
|
||||
end
|
||||
|
||||
# Declare the sdk command for fish
|
||||
function sdk -d "Manage SDKs"
|
||||
# Runs the given command in bash, capturing some side effects
|
||||
# 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.
|
||||
# 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.
|
||||
# TODO: Can somebody get this to work without the overhead of a file?
|
||||
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 bashPath $bashDump[1]
|
||||
|
@ -24,4 +26,9 @@ function sdk -d "Manage SDKs"
|
|||
end
|
||||
|
||||
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
|
|
@ -39,6 +39,8 @@ for sdk_cmd in $test_commands
|
|||
echo ""
|
||||
end
|
||||
|
||||
rm {sout, status, path}_{bash, fish}
|
||||
|
||||
echo "Ran $test_count commands with 3 checks each."
|
||||
echo "$failures/$check_count checks failed."
|
||||
exit (math $failures != 0)
|
Loading…
Add table
Add a link
Reference in a new issue