1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Sun Aug 16 01:25:01 2015 +0200
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Sun Aug 16 01:40:44 2015 +0200
1.3 @@ -239,7 +239,7 @@
1.4 }
1.5 }
1.6
1.7 - private void writeBashCompletionHelperFileForFormatterProperties(File formattersDir) throws ClassNotFoundException {
1.8 + private void writeBashCompletionHelperFileForFormatterProperties(File formattersDir) throws ClassNotFoundException, FileNotFoundException {
1.9 if (Constants.CONFIG_FILE.lastModified() > formattersDir.lastModified()) {
1.10 // TODO: delete old directory
1.11 formattersDir.mkdir();
1.12 @@ -250,12 +250,20 @@
1.13 Class<Formatter> formatterClass = (Class<Formatter>) Class.forName(fd.getClassName());
1.14 List<Class<? extends Formatter>> hierarchy = Functions.getClassHierarchy(formatterClass, Formatter.class);
1.15 Collections.reverse(hierarchy);
1.16 - hierarchy.stream().forEach((c) -> {
1.17 + for (Class<? extends Formatter> c : hierarchy) {
1.18 for (PropertyDeclaration p : Functions.getPropertyDeclarations(c)) {
1.19 File propertyDir = new File(formatterDir, p.name());
1.20 propertyDir.mkdir();
1.21 + File choicesFile = new File(propertyDir, "choices");
1.22 + try (PrintWriter fw = new PrintWriter(choicesFile)) {
1.23 + // TODO: refactor, move
1.24 + if (p.type() == Boolean.class) {
1.25 + fw.println("true");
1.26 + fw.println("false");
1.27 + }
1.28 + }
1.29 }
1.30 - });
1.31 + }
1.32 }
1.33 log.log(Level.FINE, "Bash completion helper files was written in: {0}", formattersDir);
1.34 } else {