Add ValueProvider for command names, use in "help"
Also, add some cases to samples Fixes #42 Add tests
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user