1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java Sat Aug 15 10:04:28 2015 +0200
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java Sat Aug 15 10:20:39 2015 +0200
1.3 @@ -22,6 +22,9 @@
1.4 import static info.globalcode.sql.dk.Functions.lpad;
1.5 import static info.globalcode.sql.dk.Functions.rpad;
1.6 import static info.globalcode.sql.dk.Functions.repeat;
1.7 +import info.globalcode.sql.dk.configuration.PropertyDeclaration;
1.8 +import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL;
1.9 +import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL_DESCRIPTION;
1.10 import java.util.List;
1.11 import java.util.regex.Matcher;
1.12 import java.util.regex.Pattern;
1.13 @@ -40,13 +43,15 @@
1.14 * @see TabularPrefetchingFormatter
1.15 * @see TabularWrappingFormatter
1.16 */
1.17 +@PropertyDeclaration(name = COLORFUL, type = Boolean.class, description = COLORFUL_DESCRIPTION)
1.18 +@PropertyDeclaration(name = TabularFormatter.PROPERTY_ASCII, type = Boolean.class, description = "whether to use ASCII table borders instead of unicode ones")
1.19 +@PropertyDeclaration(name = TabularFormatter.PROPERTY_TRIM, type = Boolean.class, description = "whether to trim the values to fit the column width")
1.20 public class TabularFormatter extends AbstractFormatter {
1.21
1.22 public static final String NAME = "tabular"; // bash-completion:formatter
1.23 private static final String HEADER_TYPE_PREFIX = " (";
1.24 private static final String HEADER_TYPE_SUFFIX = ")";
1.25 public static final String PROPERTY_ASCII = "ascii";
1.26 - public static final String PROPERTY_COLORFUL = "color";
1.27 public static final String PROPERTY_TRIM = "trim";
1.28 private static final String NBSP = " ";
1.29 private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\r|\\t|" + NBSP);
1.30 @@ -67,7 +72,7 @@
1.31 out = new ColorfulPrintWriter(formatterContext.getOutputStream());
1.32 asciiNostalgia = formatterContext.getProperties().getBoolean(PROPERTY_ASCII, false);
1.33 trimValues = formatterContext.getProperties().getBoolean(PROPERTY_TRIM, false);
1.34 - out.setColorful(formatterContext.getProperties().getBoolean(PROPERTY_COLORFUL, true));
1.35 + out.setColorful(formatterContext.getProperties().getBoolean(COLORFUL, true));
1.36 }
1.37
1.38 @Override