mirror of
https://github.com/alibaba/arthas.git
synced 2026-11-30 15:33:59 +00:00
remove unnecessary -p option in the redefine command. close #492
This commit is contained in:
1 parent
6073b22ea6
commit
73e5f15adb
1 file changed
+5
-9
@@ -15,6 +15,7 @@ import org.objectweb.asm.ClassReader;
|
|||||||
import com.taobao.arthas.core.command.Constants;
|
import com.taobao.arthas.core.command.Constants;
|
||||||
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
||||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
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.Description;
|
||||||
import com.taobao.middleware.cli.annotations.Name;
|
import com.taobao.middleware.cli.annotations.Name;
|
||||||
import com.taobao.middleware.cli.annotations.Option;
|
import com.taobao.middleware.cli.annotations.Option;
|
||||||
@@ -29,8 +30,8 @@ import com.taobao.middleware.cli.annotations.Summary;
|
|||||||
@Name("redefine")
|
@Name("redefine")
|
||||||
@Summary("Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)")
|
@Summary("Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)")
|
||||||
@Description(Constants.EXAMPLE +
|
@Description(Constants.EXAMPLE +
|
||||||
" redefine -p /tmp/Test.class\n" +
|
" redefine /tmp/Test.class\n" +
|
||||||
" redefine -c 327a647b -p /tmp/Test.class /tmp/Test\\$Inner.class \n" +
|
" redefine -c 327a647b /tmp/Test.class /tmp/Test\\$Inner.class \n" +
|
||||||
Constants.WIKI + Constants.WIKI_HOME + "redefine")
|
Constants.WIKI + Constants.WIKI_HOME + "redefine")
|
||||||
public class RedefineCommand extends AnnotatedCommand {
|
public class RedefineCommand extends AnnotatedCommand {
|
||||||
|
|
||||||
@@ -46,19 +47,14 @@ public class RedefineCommand extends AnnotatedCommand {
|
|||||||
this.hashCode = hashCode;
|
this.hashCode = hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Option(shortName = "p", longName = "path", acceptMultipleValues = true)
|
@Argument(argName = "classfilePaths", index = 0)
|
||||||
@Description(".class file paths")
|
@Description(".class file paths")
|
||||||
public void setPathPatterns(List<String> paths) {
|
public void setPaths(List<String> paths) {
|
||||||
this.paths = paths;
|
this.paths = paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(CommandProcess process) {
|
public void process(CommandProcess process) {
|
||||||
if (paths == null || paths.isEmpty()) {
|
|
||||||
process.write("paths is empty.\n");
|
|
||||||
process.end();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Instrumentation inst = process.session().getInstrumentation();
|
Instrumentation inst = process.session().getInstrumentation();
|
||||||
|
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
|
|||||||
Reference in new issue
Block a user