mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
improve history command. close #1140
This commit is contained in:
@@ -29,7 +29,7 @@ public class HistoryCommand extends AnnotatedCommand {
|
||||
boolean clear = false;
|
||||
int n = -1;
|
||||
|
||||
@Option(shortName = "c", longName = "clear")
|
||||
@Option(shortName = "c", longName = "clear", flag = true , acceptValue = false)
|
||||
@Description("clear history")
|
||||
public void setClear(boolean clear) {
|
||||
this.clear = clear;
|
||||
@@ -56,7 +56,7 @@ public class HistoryCommand extends AnnotatedCommand {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int size = history.size();
|
||||
if (n < 0) {
|
||||
if (n < 0 || n > size) {
|
||||
n = size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user