mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 13:27:10 -07:00
parent
9b563135ed
commit
193189ed91
4 changed files with 50 additions and 11 deletions
|
@ -8,7 +8,7 @@ Also adds binaries from installed SDKs to the PATH.
|
||||||
Version 1.4.0 tested with
|
Version 1.4.0 tested with
|
||||||
|
|
||||||
- fish 2.7.1 and 3.1.2, and
|
- fish 2.7.1 and 3.1.2, and
|
||||||
- SDKMAN! 5.8.2, on
|
- SDKMAN! 5.9.1, on
|
||||||
- Ubuntu 18.04 LTS and macOS 10.13
|
- Ubuntu 18.04 LTS and macOS 10.13
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
|
@ -20,8 +20,11 @@ Feature: Shell Completion
|
||||||
| b | b, broadcast | /^[^b]+$/ |
|
| b | b, broadcast | /^[^b]+$/ |
|
||||||
| c | c, current | /^[^c]+$/ |
|
| c | c, current | /^[^c]+$/ |
|
||||||
| d | d, default | /^[^d]+$/ |
|
| d | d, default | /^[^d]+$/ |
|
||||||
|
| e | e, env | /^[^e]+$/ |
|
||||||
| f | flush | /^[^f]+$/ |
|
| f | flush | /^[^f]+$/ |
|
||||||
| h | h, help | /^[^h]+$/ |
|
| h | h, help, home | /^[^h]+$/ |
|
||||||
|
| he | help | |
|
||||||
|
| ho | home | |
|
||||||
| i | i, install | /^[^i]+$/ |
|
| i | i, install | /^[^i]+$/ |
|
||||||
| in | install | |
|
| in | install | |
|
||||||
| l | list, ls | /^[^l]+$/ |
|
| l | list, ls | /^[^l]+$/ |
|
||||||
|
@ -36,7 +39,6 @@ Feature: Shell Completion
|
||||||
# Currently uncovered (except by fuzzy matches);
|
# Currently uncovered (except by fuzzy matches);
|
||||||
# include negatives to prevent accidents:
|
# include negatives to prevent accidents:
|
||||||
| a | | /^a/ |
|
| a | | /^a/ |
|
||||||
| e | | /^e/ |
|
|
||||||
| g | | /^g/ |
|
| g | | /^g/ |
|
||||||
| j | | /^j/ |
|
| j | | /^j/ |
|
||||||
| k | | /^k/ |
|
| k | | /^k/ |
|
||||||
|
@ -175,14 +177,38 @@ Feature: Shell Completion
|
||||||
Then completion should propose "<completions>"
|
Then completion should propose "<completions>"
|
||||||
But completion should not propose <exclusions>
|
But completion should not propose <exclusions>
|
||||||
Examples:
|
Examples:
|
||||||
| cmd | completions | exclusions |
|
| cmd | completions | exclusions |
|
||||||
| | archives, broadcast, temp | /^(?!archives\|broadcast\|temp).*$/ |
|
| | archives, broadcast, tmp, version | /^(?!archives\|broadcast\|tmp\|version).*$/ |
|
||||||
| b | broadcast | /^(?!broadcast).*$/ |
|
| b | broadcast | /^(?!broadcast).*$/ |
|
||||||
| a | archives | /^(?!archives\|broadcast).*$/ |
|
| a | archives | /^(?!archives\|broadcast).*$/ |
|
||||||
| t | temp | /^(?!temp\|broadcast).*$/ |
|
| t | tmp | /^(?!tmp\|broadcast).*$/ |
|
||||||
| x | | /.*/ |
|
| v | version | /^(?!version\|archives).*$/ |
|
||||||
| 'temp ' | | /.*/ |
|
| x | | /.*/ |
|
||||||
|
| 'tmp ' | | /.*/ |
|
||||||
|
|
||||||
|
Scenario Outline: Completion for 'home'
|
||||||
|
When the user enters "home <cmd>" into the prompt
|
||||||
|
Then completion should propose "<completions>"
|
||||||
|
But completion should not propose <exclusions>
|
||||||
|
Examples:
|
||||||
|
| cmd | completions | exclusions |
|
||||||
|
| | ant, crash | gradle |
|
||||||
|
| an | ant | crash, gradle |
|
||||||
|
| j | | /.*/ |
|
||||||
|
| 1. | | /.*/ |
|
||||||
|
| 'ant ' | 1.10.1, 1.9.9 | /^\w+$/ |
|
||||||
|
| 'ant 1.10.1 ' | | /.*/ |
|
||||||
|
|
||||||
|
Scenario Outline: Completion for 'env'
|
||||||
|
When the user enters "env <cmd>" into the prompt
|
||||||
|
Then completion should propose "<completions>"
|
||||||
|
But completion should not propose <exclusions>
|
||||||
|
Examples:
|
||||||
|
| cmd | completions | exclusions |
|
||||||
|
| | init | /^(?!init).*$/ |
|
||||||
|
| i | init | /^(?!init).*$/ |
|
||||||
|
| a | | /.*/ |
|
||||||
|
| 'init ' | | /.*/ |
|
||||||
|
|
||||||
Scenario Outline: Completion for commands without parameters
|
Scenario Outline: Completion for commands without parameters
|
||||||
When the user enters "<cmd>" into the prompt
|
When the user enters "<cmd>" into the prompt
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
$index_updated = false # TODO: Hack since Cucumber doesn't have Feature-level hooks
|
$index_updated = false # TODO: Hack since Cucumber doesn't have Feature-level hooks
|
||||||
Given(/^SDKMAN! candidate list is up to date$/) do
|
Given(/^SDKMAN! candidate list is up to date$/) do
|
||||||
unless $index_updated
|
unless $index_updated
|
||||||
|
@ -39,6 +41,11 @@ When(/^candidate (\w+) is uninstalled$/) do |candidate|
|
||||||
puts `ls ~/.sdkman/candidates/#{candidate}`
|
puts `ls ~/.sdkman/candidates/#{candidate}`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given(/^file ([a-zA-Z0-9-_.\/]+) exists with content/) do |filename,content|
|
||||||
|
FileUtils.mkdir_p(File.dirname(filename))
|
||||||
|
File.write(filename, content)
|
||||||
|
end
|
||||||
|
|
||||||
# Uninstall all SDKMAN! candidates
|
# Uninstall all SDKMAN! candidates
|
||||||
# TODO: Run after every scenario, this makes tests very slow.
|
# TODO: Run after every scenario, this makes tests very slow.
|
||||||
# Currently, Cucumber doesn't have Feature-level hooks, so we have to work around:
|
# Currently, Cucumber doesn't have Feature-level hooks, so we have to work around:
|
||||||
|
|
|
@ -4,12 +4,16 @@ Feature: Wrapping of Bash
|
||||||
the effect sdk has on the Bash environment carries
|
the effect sdk has on the Bash environment carries
|
||||||
over the current Fish session.
|
over the current Fish session.
|
||||||
|
|
||||||
We verifiy equality of (standard) output, exit code, and environment variables.
|
We verify equality of (standard) output, exit code, and environment variables.
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given SDKMAN! candidate list is up to date
|
Given SDKMAN! candidate list is up to date
|
||||||
And candidate ant is installed at version 1.9.9
|
And candidate ant is installed at version 1.9.9
|
||||||
And candidate ant is installed at version 1.10.1
|
And candidate ant is installed at version 1.10.1
|
||||||
|
And file /tmp/env-test/.sdkmanrc exists with content
|
||||||
|
"""
|
||||||
|
ant=1.9.9
|
||||||
|
"""
|
||||||
|
|
||||||
Scenario Outline:
|
Scenario Outline:
|
||||||
When we run "<command>" in Bash and Fish
|
When we run "<command>" in Bash and Fish
|
||||||
|
@ -28,3 +32,5 @@ Feature: Wrapping of Bash
|
||||||
| sdk use ant 1.9.9 |
|
| sdk use ant 1.9.9 |
|
||||||
| sdk offline enable > /dev/null; sdk install ant foo |
|
| sdk offline enable > /dev/null; sdk install ant foo |
|
||||||
| sdk use ant 1.9.9 > /dev/null; sdk broadcast |
|
| sdk use ant 1.9.9 > /dev/null; sdk broadcast |
|
||||||
|
| sdk home ant 1.9.9 |
|
||||||
|
| cd /tmp/env-test; sdk env |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue