Add ValueProvider for command names, use in "help"

Also, add some cases to samples

Fixes #42

Add tests
This commit is contained in:
Eric Bottard
2017-05-18 21:02:22 +02:00
parent f15fb0ba9d
commit 011f6adb9a
6 changed files with 171 additions and 12 deletions

View File

@@ -21,11 +21,13 @@ import java.lang.reflect.Method;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
/**
* Created by ericbottard on 09/12/15.
*/
@Component
public class LegacyCommands implements CommandMarker {
public static final Method REGISTER_METHOD = ReflectionUtils.findMethod(LegacyCommands.class, "register", String.class, ArtifactType.class, String.class, boolean.class);

View File

@@ -16,6 +16,9 @@
package org.springframework.shell2.samples.standard;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import org.springframework.shell2.standard.ShellComponent;
import org.springframework.shell2.standard.ShellMethod;
@@ -46,4 +49,9 @@ public class Commands {
public int add(int ahbahdisdonc, int b, int c) {
return ahbahdisdonc + b + c;
}
@ShellMethod(help = "Fails with an exception")
public void fail(ElementType elementType) {
throw new IllegalArgumentException("You said " + elementType);
}
}