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
public String toString() {
final StringBuffer sb = new StringBuffer("PluginInfo{");
sb.append("name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", site=").append(site);
sb.append(", jvm=").append(jvm);
final StringBuilder information = new StringBuilder()
.append("- Plugin information:\n")
.append("Name: ").append(name).append("\n")
.append("Description: ").append(description).append("\n")
.append("Site: ").append(site).append("\n")
.append("Version: ").append(version).append("\n")
.append("JVM: ").append(jvm).append("\n");
if (jvm) {
sb.append(", classname=").append(classname);
sb.append(", isolated=").append(isolated);
information.append(" * Classname: ").append(classname).append("\n");
information.append(" * Isolated: ").append(isolated);
}
sb.append(", version='").append(version).append('\'');
sb.append('}');
return sb.toString();
return information.toString();
}
}