From fc418de46e3f1b9393f540c029893452ed0a6508 Mon Sep 17 00:00:00 2001 From: Andrey Fadeyev Date: Sat, 15 Aug 2015 14:42:29 +0100 Subject: [PATCH] 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 --- .../org/elasticsearch/plugins/PluginInfo.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java b/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java index 66f24e3a8c8..59ac62659ef 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java @@ -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(); } }