mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
Offer to install SDKMAN! if not already installed.
Fixes issue #26 Also: - Change language in README to clarify that SDKMAN! is not included. - Polishes to `.editorconfig`.
This commit is contained in:
parent
47ec1e3847
commit
e41ccb9ce8
4 changed files with 50 additions and 11 deletions
|
@ -1,5 +1,12 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
[![Build Status][travis-badge]][travis-link]
|
[![Build Status][travis-badge]][travis-link]
|
||||||
|
|
||||||
Makes command `sdk` from [SDKMAN!] available in fish.
|
Makes command `sdk` from [SDKMAN!] usable from fish, including auto-completion.
|
||||||
Also provides auto-completion and adds binaries from installed SDKs to the PATH.
|
Also adds binaries from installed SDKs to the PATH.
|
||||||
|
|
||||||
Tested with fish 2.7.1 and 3.0.2, and SDKMAN! 5.7.3.
|
Tested with fish 2.7.1 and 3.0.2, and SDKMAN! 5.7.3.
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@ With [fisher] (install separately):
|
||||||
fisher add reitzig/sdkman-for-fish
|
fisher add reitzig/sdkman-for-fish
|
||||||
```
|
```
|
||||||
|
|
||||||
_Note:_ Only compatible with fisher v3 upwards; v2 is no longer supported.
|
_Note:_
|
||||||
|
|
||||||
|
- Only compatible with fisher v3 upwards; v2 is no longer supported.
|
||||||
|
- You have to install [SDKMAN!] separately.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,36 @@
|
||||||
# Guard: SDKMAN! needs to be installed
|
|
||||||
if not test -f "$__fish_sdkman_init"
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# Declare the sdk command for fish
|
|
||||||
function sdk -d "Manage SDKs"
|
function sdk -d "Manage SDKs"
|
||||||
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$__fish_sdkman_init"
|
||||||
|
# Propose to install SDKMAN!
|
||||||
|
|
||||||
|
function read_confirm
|
||||||
|
while true
|
||||||
|
read -l -P "$argv[1] [y/N] " confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
return 0
|
||||||
|
case '' N n
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if read_confirm "You don't seem to have SDKMAN! installed. Install now?"
|
||||||
|
if not which curl > /dev/null
|
||||||
|
echo "curl required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if not which bash > /dev/null
|
||||||
|
echo "bash required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
curl -s "https://get.sdkman.io" | bash | sed '/All done!/q'
|
||||||
|
echo "Please open a new terminal/shell to load SDKMAN!"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Declare the _actual_ sdk command for fish
|
||||||
|
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,3 +23,5 @@ begin
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: add test that fails if `test` in conf.d/sdk.fish:80 errors (cf issue #28 et al.)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue