public static ReportGenerator.Format getFormat( String... args ) {
        ConfigOptionParser configParser = new ConfigOptionParser();
        List<ConfigOption> configOptions = Arrays.asList( format, help );

        for( ConfigOption co : configOptions ) {
            if( co.hasDefault() ) {
                configParser.parsedOptions.put( co.getLongName(), co.getValue() );
            }
        }

        for( String arg : args ) {
            configParser.commandLineLookup( arg, format, configOptions );
        }

        // TODO properties
        // TODO environment

        if( !configParser.hasValue( format ) ) {
            configParser.printUsageAndExit( configOptions );
        }
        return (ReportGenerator.Format) configParser.getValue( format );
    }
public static ReportGenerator . Format getFormat ( String ... args ) { ConfigOptionParser configParser = new ConfigOptionParser ( ) ; List < ConfigOption > configOptions = Arrays . asList ( format , help ) ; for ( ConfigOption co : configOptions ) { if ( co . hasDefault ( ) ) { configParser . parsedOptions . put ( co . getLongName ( ) , co . getValue ( ) ) ; } } for ( String arg : args ) { configParser . commandLineLookup ( arg , format , configOptions ) ; } if ( ! configParser . hasValue ( format ) ) { configParser . printUsageAndExit ( configOptions ) ; } return ( ReportGenerator . Format ) configParser . getValue ( format ) ; }
Terminates  with a help message if the parse is not successful

@param args command line arguments to
@return the format in a correct state