mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 13:27:10 -07:00
fix: Respect globally set SDKMAN_DIR
Also, print a warning during shell startup if a custom install path is set, but SDKMAN! is not installed there. fixes #52
This commit is contained in:
parent
5f2ae91d5f
commit
a0aa142288
5 changed files with 43 additions and 25 deletions
|
@ -5,14 +5,18 @@ Feature: Corner Cases
|
|||
When a new Fish shell is launched
|
||||
Then environment variable SDKMAN_DIR has the original value
|
||||
|
||||
Scenario: sdk initialized for another user in this shell
|
||||
# Use any directory outside of the user's home directory
|
||||
Given environment variable SDKMAN_DIR is set to "/"
|
||||
When a new Fish shell is launched
|
||||
Then environment variable SDKMAN_DIR has the original value
|
||||
|
||||
Scenario: Custom installation path
|
||||
Scenario: Custom installation path via env var
|
||||
Given SDKMAN! is installed at /tmp/sdkman
|
||||
And environment variable SDKMAN_DIR is set to "/tmp/sdkman"
|
||||
When we run "sdk version" in Fish
|
||||
Then the exit code is 0
|
||||
And the output contains "SDKMAN!"
|
||||
And environment variable SDKMAN_DIR has value "/tmp/sdkman"
|
||||
And environment variable ANT_HOME has value "/tmp/sdkman/candidates/ant/current"
|
||||
|
||||
Scenario: Custom installation path via fish config
|
||||
Given SDKMAN! is installed at /tmp/sdkman
|
||||
And environment variable SDKMAN_DIR is set to "/something/wicked"
|
||||
And fish config file config_sdk.fish exists with content
|
||||
"""
|
||||
set -g __sdkman_custom_dir /tmp/sdkman
|
||||
|
@ -25,10 +29,7 @@ Feature: Corner Cases
|
|||
|
||||
Scenario Outline: Completions with custom installation path
|
||||
Given SDKMAN! is installed at /tmp/sdkman
|
||||
And fish config file config_sdk.fish exists with content
|
||||
"""
|
||||
set -g __sdkman_custom_dir /tmp/sdkman
|
||||
"""
|
||||
And environment variable SDKMAN_DIR is set to "/tmp/sdkman"
|
||||
When the user enters "<cmd>" into the prompt
|
||||
Then completion should propose "<completions>"
|
||||
Examples:
|
||||
|
|
|
@ -64,10 +64,12 @@ def run_fish_command(cmd)
|
|||
end.to_h
|
||||
|
||||
out, status = Open3.capture2e(<<~FISH
|
||||
#{@command.nil? ? '' : @command}
|
||||
fish -c '#{cmd} > #{files[:stdout]} 2> #{files[:stderr]}; \
|
||||
echo $status > #{files[:status]}; \
|
||||
env > #{files[:env]}; \
|
||||
'
|
||||
#{@command.nil? ? '' : ')'}
|
||||
FISH
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue