mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
change prompt to arthas@pid (#803)
This commit is contained in:
@@ -46,6 +46,7 @@ public class ShellImpl implements Shell {
|
||||
private Term term;
|
||||
private String welcome;
|
||||
private Job currentForegroundJob;
|
||||
private String prompt;
|
||||
|
||||
public ShellImpl(ShellServer server, Term term, InternalCommandManager commandManager,
|
||||
Instrumentation instrumentation, int pid, JobControllerImpl jobController) {
|
||||
@@ -64,6 +65,8 @@ public class ShellImpl implements Shell {
|
||||
if (term != null) {
|
||||
term.setSession(session);
|
||||
}
|
||||
|
||||
this.setPrompt();
|
||||
}
|
||||
|
||||
public JobController jobController() {
|
||||
@@ -106,6 +109,14 @@ public class ShellImpl implements Shell {
|
||||
this.welcome = welcome;
|
||||
}
|
||||
|
||||
private void setPrompt(){
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("[arthas@");
|
||||
stringBuilder.append(session.getPid());
|
||||
stringBuilder.append("]$ ");
|
||||
this.prompt = stringBuilder.toString();
|
||||
}
|
||||
|
||||
public ShellImpl init() {
|
||||
term.interruptHandler(new InterruptHandler(this));
|
||||
term.suspendHandler(new SuspendHandler(this));
|
||||
@@ -142,7 +153,7 @@ public class ShellImpl implements Shell {
|
||||
}
|
||||
|
||||
public void readline() {
|
||||
term.readline(Constants.DEFAULT_PROMPT, new ShellLineHandler(this),
|
||||
term.readline(prompt, new ShellLineHandler(this),
|
||||
new CommandManagerCompletionHandler(commandManager));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user