remove unnecessary -p option in the redefine command. close #492

This commit is contained in:
hengyunabc 2019-02-06 01:45:41 +08:00
parent 6073b22ea6
commit 73e5f15adb

View File

@ -15,6 +15,7 @@ import org.objectweb.asm.ClassReader;
import com.taobao.arthas.core.command.Constants;
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
import com.taobao.arthas.core.shell.command.CommandProcess;
import com.taobao.middleware.cli.annotations.Argument;
import com.taobao.middleware.cli.annotations.Description;
import com.taobao.middleware.cli.annotations.Name;
import com.taobao.middleware.cli.annotations.Option;
@ -29,8 +30,8 @@ import com.taobao.middleware.cli.annotations.Summary;
@Name("redefine")
@Summary("Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)")
@Description(Constants.EXAMPLE +
" redefine -p /tmp/Test.class\n" +
" redefine -c 327a647b -p /tmp/Test.class /tmp/Test\\$Inner.class \n" +
" redefine /tmp/Test.class\n" +
" redefine -c 327a647b /tmp/Test.class /tmp/Test\\$Inner.class \n" +
Constants.WIKI + Constants.WIKI_HOME + "redefine")
public class RedefineCommand extends AnnotatedCommand {
@ -46,19 +47,14 @@ public class RedefineCommand extends AnnotatedCommand {
this.hashCode = hashCode;
}
@Option(shortName = "p", longName = "path", acceptMultipleValues = true)
@Argument(argName = "classfilePaths", index = 0)
@Description(".class file paths")
public void setPathPatterns(List<String> paths) {
public void setPaths(List<String> paths) {
this.paths = paths;
}
@Override
public void process(CommandProcess process) {
if (paths == null || paths.isEmpty()) {
process.write("paths is empty.\n");
process.end();
return;
}
Instrumentation inst = process.session().getInstrumentation();
for (String path : paths) {