From e159cfcc5294af14bf1d27fbc684970e8b959794 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Sat, 20 Apr 2024 08:13:12 +0100 Subject: [PATCH] Change properties for interactive and script to false on default - Change defaults for `spring.shell.interactive.enabled` and `spring.shell.script.enabled` to false. - Change samples to use interactive/script where applicable. - Fixes #1051 --- .../shell/boot/SpringShellProperties.java | 6 +++--- .../shell/boot/SpringShellPropertiesTests.java | 14 +++++++------- .../src/main/resources/application.yml | 2 ++ .../src/main/resources/application.yml | 2 ++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/SpringShellProperties.java b/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/SpringShellProperties.java index 376796ca..50b63754 100644 --- a/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/SpringShellProperties.java +++ b/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/SpringShellProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -162,7 +162,7 @@ public class SpringShellProperties { public static class Script { - private boolean enabled = true; + private boolean enabled = false; public boolean isEnabled() { return enabled; @@ -175,7 +175,7 @@ public class SpringShellProperties { public static class Interactive { - private boolean enabled = true; + private boolean enabled = false; public boolean isEnabled() { return enabled; diff --git a/spring-shell-autoconfigure/src/test/java/org/springframework/shell/boot/SpringShellPropertiesTests.java b/spring-shell-autoconfigure/src/test/java/org/springframework/shell/boot/SpringShellPropertiesTests.java index d482a10a..462dc320 100644 --- a/spring-shell-autoconfigure/src/test/java/org/springframework/shell/boot/SpringShellPropertiesTests.java +++ b/spring-shell-autoconfigure/src/test/java/org/springframework/shell/boot/SpringShellPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +38,8 @@ public class SpringShellPropertiesTests { assertThat(properties.getHistory().getName()).isNull(); assertThat(properties.getConfig().getLocation()).isNull(); assertThat(properties.getConfig().getEnv()).isNull(); - assertThat(properties.getScript().isEnabled()).isTrue(); - assertThat(properties.getInteractive().isEnabled()).isTrue(); + assertThat(properties.getScript().isEnabled()).isFalse(); + assertThat(properties.getInteractive().isEnabled()).isFalse(); assertThat(properties.getNoninteractive().isEnabled()).isTrue(); assertThat(properties.getNoninteractive().getPrimaryCommand()).isNull(); assertThat(properties.getTheme().getName()).isNull(); @@ -81,8 +81,8 @@ public class SpringShellPropertiesTests { .withPropertyValues("spring.shell.history.name=fakename") .withPropertyValues("spring.shell.config.location=fakelocation") .withPropertyValues("spring.shell.config.env=FAKE_ENV") - .withPropertyValues("spring.shell.script.enabled=false") - .withPropertyValues("spring.shell.interactive.enabled=false") + .withPropertyValues("spring.shell.script.enabled=true") + .withPropertyValues("spring.shell.interactive.enabled=true") .withPropertyValues("spring.shell.noninteractive.enabled=false") .withPropertyValues("spring.shell.noninteractive.primary-command=fakecommand") .withPropertyValues("spring.shell.theme.name=fake") @@ -121,8 +121,8 @@ public class SpringShellPropertiesTests { assertThat(properties.getHistory().getName()).isEqualTo("fakename"); assertThat(properties.getConfig().getLocation()).isEqualTo("fakelocation"); assertThat(properties.getConfig().getEnv()).isEqualTo("FAKE_ENV"); - assertThat(properties.getScript().isEnabled()).isFalse(); - assertThat(properties.getInteractive().isEnabled()).isFalse(); + assertThat(properties.getScript().isEnabled()).isTrue(); + assertThat(properties.getInteractive().isEnabled()).isTrue(); assertThat(properties.getNoninteractive().isEnabled()).isFalse(); assertThat(properties.getNoninteractive().getPrimaryCommand()).isEqualTo("fakecommand"); assertThat(properties.getTheme().getName()).isEqualTo("fake"); diff --git a/spring-shell-samples/spring-shell-sample-commands/src/main/resources/application.yml b/spring-shell-samples/spring-shell-sample-commands/src/main/resources/application.yml index 37ebaf0b..e761ee69 100644 --- a/spring-shell-samples/spring-shell-sample-commands/src/main/resources/application.yml +++ b/spring-shell-samples/spring-shell-sample-commands/src/main/resources/application.yml @@ -2,6 +2,8 @@ spring: main: banner-mode: off shell: + script: + enabled: true interactive: enabled: true ## pick global default option naming diff --git a/spring-shell-samples/spring-shell-sample-e2e/src/main/resources/application.yml b/spring-shell-samples/spring-shell-sample-e2e/src/main/resources/application.yml index 37ebaf0b..e761ee69 100644 --- a/spring-shell-samples/spring-shell-sample-e2e/src/main/resources/application.yml +++ b/spring-shell-samples/spring-shell-sample-e2e/src/main/resources/application.yml @@ -2,6 +2,8 @@ spring: main: banner-mode: off shell: + script: + enabled: true interactive: enabled: true ## pick global default option naming