add pwd command. #493

This commit is contained in:
hengyunabc 2019-02-06 14:59:31 +08:00
parent 73e5f15adb
commit 793df05b2f
2 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.taobao.arthas.core.command.basic1000.ClsCommand;
import com.taobao.arthas.core.command.basic1000.HelpCommand;
import com.taobao.arthas.core.command.basic1000.HistoryCommand;
import com.taobao.arthas.core.command.basic1000.KeymapCommand;
import com.taobao.arthas.core.command.basic1000.PwdCommand;
import com.taobao.arthas.core.command.basic1000.ResetCommand;
import com.taobao.arthas.core.command.basic1000.SessionCommand;
import com.taobao.arthas.core.command.basic1000.ShutdownCommand;
@ -85,5 +86,6 @@ public class BuiltinCommandPack implements CommandResolver {
commands.add(Command.create(SystemPropertyCommand.class));
commands.add(Command.create(SystemEnvCommand.class));
commands.add(Command.create(HistoryCommand.class));
commands.add(Command.create(PwdCommand.class));
}
}

View File

@ -0,0 +1,18 @@
package com.taobao.arthas.core.command.basic1000;
import java.io.File;
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
import com.taobao.arthas.core.shell.command.CommandProcess;
import com.taobao.middleware.cli.annotations.Name;
import com.taobao.middleware.cli.annotations.Summary;
@Name("pwd")
@Summary("Return working directory name")
public class PwdCommand extends AnnotatedCommand {
@Override
public void process(CommandProcess process) {
process.write(new File("").getAbsolutePath()).write("\n");
process.end();
}
}