Document bean validation constraints in help()

Fixes #147
This commit is contained in:
Eric Bottard
2017-09-08 14:19:01 +02:00
parent 665f319d5f
commit 32c18bec75
10 changed files with 307 additions and 120 deletions

View File

@@ -26,6 +26,8 @@ import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import javax.validation.constraints.Min;
/**
* A sample of legacy Shell 1 commands that can be run thanks to the legacy adapter.
*
@@ -76,7 +78,7 @@ public class LegacyCommands implements CommandMarker {
@CliCommand(value = "sum2", help = "adds two numbers")
public int sum2(
@CliOption(key = "v1", unspecifiedDefaultValue = "38") int a,
@CliOption(key = "v1", unspecifiedDefaultValue = "38") @Min(5) int a,
@CliOption(key = "v2", specifiedDefaultValue = "42", mandatory = true) int b,
@CliOption(key = "v3", mandatory = false) int c) {
return a + b + c;