Format plugin info a bit more user-friendly to output it in a terminal

Before:

PluginInfo{name='cloud-aws', description='The Amazon Web Service (AWS) Cloud plugin allows to use AWS API for the unicast discovery mechanism and add S3 repositories.', site=false, jvm=true, classname=org.elasticsearch.plugin.cloud.aws.CloudAwsPlugin, isolated=true, version='2.1.0-SNAPSHOT'}

After:

- Plugin information:
Name: cloud-aws
Description: The Amazon Web Service (AWS) Cloud plugin allows to use AWS API for the unicast discovery mechanism and add S3 repositories.
Site: false
Version: 2.1.0-SNAPSHOT
JVM: true
 * Classname: org.elasticsearch.plugin.cloud.aws.CloudAwsPlugin
 * Isolated: true
This commit is contained in:
Andrey Fadeyev 2015-08-15 14:42:29 +01:00
parent 7d6acde538
commit fc418de46e
1 changed files with 12 additions and 10 deletions

View File

@ -262,17 +262,19 @@ public class PluginInfo implements Streamable, ToXContent {
@Override @Override
public String toString() { public String toString() {
final StringBuffer sb = new StringBuffer("PluginInfo{"); final StringBuilder information = new StringBuilder()
sb.append("name='").append(name).append('\''); .append("- Plugin information:\n")
sb.append(", description='").append(description).append('\''); .append("Name: ").append(name).append("\n")
sb.append(", site=").append(site); .append("Description: ").append(description).append("\n")
sb.append(", jvm=").append(jvm); .append("Site: ").append(site).append("\n")
.append("Version: ").append(version).append("\n")
.append("JVM: ").append(jvm).append("\n");
if (jvm) { if (jvm) {
sb.append(", classname=").append(classname); information.append(" * Classname: ").append(classname).append("\n");
sb.append(", isolated=").append(isolated); information.append(" * Isolated: ").append(isolated);
} }
sb.append(", version='").append(version).append('\'');
sb.append('}'); return information.toString();
return sb.toString();
} }
} }