File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1717#
1818
1919function __sdk_config() {
20- local -r editor=${EDITOR:= vi}
20+ local -r editor=( ${EDITOR:= vi} )
2121
22- if ! command -v " $editor " > /dev/null; then
22+ if ! command -v " ${ editor[@]} " > /dev/null; then
2323 __sdkman_echo_red " No default editor configured."
2424 __sdkman_echo_yellow " Please set the default editor with the EDITOR environment variable."
2525
2626 return 1
2727 fi
2828
29- " $editor " " ${SDKMAN_DIR} /etc/config"
29+ " ${ editor[@]} " " ${SDKMAN_DIR} /etc/config"
3030}
Original file line number Diff line number Diff line change @@ -23,11 +23,15 @@ class ConfigCommandSpec extends SdkmanEnvSpecification {
2323 where :
2424 setupEnv << [
2525 {
26- it. execute(' nano() { echo "nano was called with $1 "; }' )
26+ it. execute(' nano() { echo "nano was called with $* "; }' )
2727 it. execute(" EDITOR=nano" )
2828 },
2929 {
30- it. execute(' vi() { echo "vi was called with $1"; }' )
30+ it. execute(' code() { echo "code was called with $*"; }' )
31+ it. execute(" EDITOR='code --wait'" )
32+ },
33+ {
34+ it. execute(' vi() { echo "vi was called with $*"; }' )
3135 it. execute(" unset EDITOR" )
3236 },
3337 {
@@ -36,6 +40,7 @@ class ConfigCommandSpec extends SdkmanEnvSpecification {
3640 ]
3741 verifyOutput << [
3842 { output , baseDirectory -> output. contains(" nano was called with ${ baseDirectory} /.sdkman/etc/config" ) },
43+ { output , baseDirectory -> output. contains(" code was called with --wait ${ baseDirectory} /.sdkman/etc/config" ) },
3944 { output , baseDirectory -> output. contains(" vi was called with ${ baseDirectory} /.sdkman/etc/config" ) },
4045 { output , _ -> output. contains(" No default editor configured." ) }
4146 ]
You can’t perform that action at this time.
0 commit comments