java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 16 Dec 2013 15:15:32 +0100
branchv_0
changeset 14 189b1260b942
parent 13 599aad77e986
child 15 bbd335b5410c
permissions -rw-r--r--
show info basics
     1 package info.globalcode.sql.dk;
     2 
     3 import java.util.logging.Level;
     4 import java.util.logging.Logger;
     5 
     6 /**
     7  *
     8  * @author Ing. František Kučera (frantovo.cz)
     9  */
    10 public class CLIStarter {
    11 
    12 	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
    13 
    14 	public static void main(String[] args) {
    15 		try {
    16 			/** Parse options */
    17 			CLIParser parser = new CLIParser();
    18 			CLIOptions options = parser.parseOptions(args);
    19 
    20 
    21 			options.validate();
    22 
    23 			/** Show info */
    24 			if (!options.getShowInfo().isEmpty()) {
    25 				InfoLister infoLister = new InfoLister();
    26 				infoLister.showInfo(options.getShowInfo(), System.err);
    27 			}
    28 
    29 		} catch (CLIParserException e) {
    30 			log.log(Level.SEVERE, "Unable to parse CLI options", e);
    31 		} catch (InvalidOptionsException e) {
    32 			log.log(Level.SEVERE, "Invalid CLI options", e);
    33 		}
    34 	}
    35 }