3 * Copyright © 2013 František Kučera (frantovo.cz)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package info.globalcode.sql.dk;
20 import java.io.BufferedReader;
21 import java.io.InputStreamReader;
22 import java.io.PrintStream;
23 import java.util.EnumSet;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
28 * Displays info like help, version etc.
30 * @author Ing. František Kučera (frantovo.cz)
32 public class InfoLister {
34 private static final Logger log = Logger.getLogger(InfoLister.class.getName());
35 private PrintStream out;
37 public InfoLister(PrintStream out) {
41 public void showInfo(CLIOptions options) {
42 EnumSet<CLIOptions.INFO_TYPE> infoTypes = options.getShowInfo();
43 for (CLIOptions.INFO_TYPE infoType : infoTypes) {
46 * TODO: implement show info
49 println("TODO: list available formatters");
52 println("TODO: show some help");
58 println("TODO: list supported types");
61 println("TODO: show version");
64 println("TODO: list databases");
67 println("TODO: test database connection: " + options.getDatabaseNameToTest());
70 throw new IllegalArgumentException("Unsupported INFO_TYPE: " + infoType);
75 private void printLicense() {
76 try (BufferedReader license = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("info/globalcode/sql/dk/license.txt")))) {
78 String line = license.readLine();
85 } catch (Exception e) {
86 log.log(Level.SEVERE, "Unable to print license. See our website for license information.", e);
90 private void println(String line) {