java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 16 Dec 2013 20:01:37 +0100
branchv_0
changeset 16 5b8fcd35d4d6
parent 15 bbd335b5410c
child 17 d8ab8aece6f2
permissions -rw-r--r--
license: GNU GPLv3+
franta-hg@16
     1
/**
franta-hg@16
     2
 * SQL-DK
franta-hg@16
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@16
     4
 *
franta-hg@16
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@16
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@16
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@16
     8
 * (at your option) any later version.
franta-hg@16
     9
 *
franta-hg@16
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@16
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@16
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@16
    13
 * GNU General Public License for more details.
franta-hg@16
    14
 *
franta-hg@16
    15
 * You should have received a copy of the GNU General Public License
franta-hg@16
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@16
    17
 */
franta-hg@1
    18
package info.globalcode.sql.dk;
franta-hg@1
    19
franta-hg@13
    20
import java.util.logging.Level;
franta-hg@13
    21
import java.util.logging.Logger;
franta-hg@13
    22
franta-hg@1
    23
/**
franta-hg@1
    24
 *
franta-hg@1
    25
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@1
    26
 */
franta-hg@1
    27
public class CLIStarter {
franta-hg@1
    28
franta-hg@13
    29
	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
franta-hg@13
    30
franta-hg@1
    31
	public static void main(String[] args) {
franta-hg@13
    32
		try {
franta-hg@14
    33
			/** Parse options */
franta-hg@13
    34
			CLIParser parser = new CLIParser();
franta-hg@13
    35
			CLIOptions options = parser.parseOptions(args);
franta-hg@14
    36
franta-hg@14
    37
			options.validate();
franta-hg@14
    38
franta-hg@14
    39
			/** Show info */
franta-hg@14
    40
			if (!options.getShowInfo().isEmpty()) {
franta-hg@14
    41
				InfoLister infoLister = new InfoLister();
franta-hg@15
    42
				infoLister.showInfo(options, System.err);
franta-hg@14
    43
			}
franta-hg@14
    44
franta-hg@13
    45
		} catch (CLIParserException e) {
franta-hg@14
    46
			log.log(Level.SEVERE, "Unable to parse CLI options", e);
franta-hg@14
    47
		} catch (InvalidOptionsException e) {
franta-hg@14
    48
			log.log(Level.SEVERE, "Invalid CLI options", e);
franta-hg@13
    49
		}
franta-hg@4
    50
	}
franta-hg@1
    51
}