support numbers
This commit is contained in:
parent
e4157cbfb8
commit
8123764154
@ -19,6 +19,9 @@ public class JSONFormatter {
|
||||
if (object instanceof String) {
|
||||
return formatString((String) object);
|
||||
}
|
||||
if (object instanceof Number) {
|
||||
return formatNumber((Number) object);
|
||||
}
|
||||
if (object instanceof Object[]) {
|
||||
return formatArr((Object[]) object);
|
||||
}
|
||||
@ -52,6 +55,10 @@ public class JSONFormatter {
|
||||
return "'" + str + "'";
|
||||
}
|
||||
|
||||
private String formatNumber(Number num) {
|
||||
return num.toString();
|
||||
}
|
||||
|
||||
public String formatList(List<?> list) {
|
||||
return formatArr(list.toArray());
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class Main {
|
||||
}
|
||||
String expr = cmdParser.getExpression();
|
||||
if (expr != null && expr.length() > 0) {
|
||||
scriptClient.execute(expr);
|
||||
console.println(formatter.format(scriptClient.getLastRpcResult()));
|
||||
Object execute = scriptClient.execute(expr);
|
||||
console.println(formatter.format(execute));
|
||||
}
|
||||
if (cmdParser.isInteractive()) {
|
||||
String command = console.readInput();
|
||||
|
Loading…
Reference in New Issue
Block a user