equal
deleted
inserted
replaced
57 } |
57 } |
58 |
58 |
59 public void showInfo() throws ConfigurationException, FormatterException { |
59 public void showInfo() throws ConfigurationException, FormatterException { |
60 EnumSet<InfoType> commands = options.getShowInfo(); |
60 EnumSet<InfoType> commands = options.getShowInfo(); |
61 |
61 |
|
62 boolean formattinNeeded = false; |
|
63 |
62 for (InfoType infoType : commands) { |
64 for (InfoType infoType : commands) { |
63 switch (infoType) { |
65 switch (infoType) { |
64 // only these need formatted output |
|
65 case CONNECTION: |
66 case CONNECTION: |
66 case DATABASES: |
67 case DATABASES: |
67 case FORMATTERS: |
68 case FORMATTERS: |
68 case TYPES: |
69 case TYPES: |
69 try (Formatter f = getFormatter()) { |
70 formattinNeeded = true; |
70 formatter = f; |
|
71 formatter.writeStartBatch(); |
|
72 formatter.writeStartDatabase(new DatabaseDefinition()); |
|
73 showInfos(commands); |
|
74 formatter.writeEndDatabase(); |
|
75 formatter.writeEndBatch(); |
|
76 formatter.close(); |
|
77 } |
|
78 break; |
71 break; |
79 default: |
72 } |
80 showInfos(commands); |
73 } |
81 } |
74 |
|
75 if (formattinNeeded) { |
|
76 try (Formatter f = getFormatter()) { |
|
77 formatter = f; |
|
78 formatter.writeStartBatch(); |
|
79 formatter.writeStartDatabase(new DatabaseDefinition()); |
|
80 showInfos(commands); |
|
81 formatter.writeEndDatabase(); |
|
82 formatter.writeEndBatch(); |
|
83 formatter.close(); |
|
84 } |
|
85 } else { |
|
86 showInfos(commands); |
82 } |
87 } |
83 } |
88 } |
84 |
89 |
85 private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException { |
90 private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException { |
86 for (InfoType infoType : commands) { |
91 for (InfoType infoType : commands) { |