public static void main(String[] args) {
    LoggingConfiguration.setVerbose(Level.VERBOSE);
    if(args.length != 2 && args.length != 4) {
      LOG.warning("I need exactly two or four file names to operate!");
      System.exit(1);
    }
    if(!args[0].endsWith(".html")) {
      LOG.warning("First file name doesn't end with .html!");
      System.exit(1);
    }
    if(!args[1].endsWith(".html")) {
      LOG.warning("Second file name doesn't end with .html!");
      System.exit(1);
    }
    if(args.length > 2 && !args[2].endsWith(".md")) {
      LOG.warning("Third file name doesn't end with .md!");
      System.exit(1);
    }
    if(args.length > 3 && !args[3].endsWith(".md")) {
      LOG.warning("Fourth file name doesn't end with .md!");
      System.exit(1);
    }
    File byclsname = new File(args[0]);
    File byoptname = new File(args[1]);
    File byclsnamew = args.length >= 3 ? new File(args[2]) : null;
    File byoptnamew = args.length >= 4 ? new File(args[3]) : null;

    try {
      createDirectories(byclsname.toPath().getParent());
      createDirectories(byoptname.toPath().getParent());
      createDirectories(byclsnamew != null ? byclsnamew.toPath().getParent() : null);
      createDirectories(byoptnamew != null ? byoptnamew.toPath().getParent() : null);
    }
    catch(IOException e) {
      LOG.exception(e);
      System.exit(1);
    }

    Map<Class<?>, List<Parameter<?>>> byclass = new HashMap<>();
    Map<OptionID, List<Pair<Parameter<?>, Class<?>>>> byopt = new HashMap<>();
    try {
      buildParameterIndex(byclass, byopt);
    }
    catch(Exception e) {
      LOG.exception(e);
      System.exit(1);
    }

    try (FileOutputStream byclassfo = new FileOutputStream(byclsname); //
        OutputStream byclassstream = new BufferedOutputStream(byclassfo)) {
      makeByClassOverview(byclass, new HTMLFormat()).writeTo(byclassstream);
    }
    catch(IOException e) {
      LOG.exception("IO Exception writing output.", e);
      System.exit(1);
    }
    if(byclsnamew != null) {
      try (FileOutputStream byclassfo = new FileOutputStream(byclsnamew); //
          MarkdownDocStream byclassstream = new MarkdownDocStream(byclassfo)) {
        makeByClassOverview(byclass, new MarkdownFormat(byclassstream));
      }
      catch(IOException e) {
        LOG.exception("IO Exception writing output.", e);
        System.exit(1);
      }
    }

    try (FileOutputStream byoptfo = new FileOutputStream(byoptname); //
        OutputStream byoptstream = new BufferedOutputStream(byoptfo)) {
      makeByOptOverview(byopt, new HTMLFormat()).writeTo(byoptstream);
    }
    catch(IOException e) {
      LOG.exception("IO Exception writing output.", e);
      System.exit(1);
    }

    if(byoptnamew != null) {
      try (FileOutputStream byoptfo = new FileOutputStream(byoptnamew); //
          MarkdownDocStream byoptstream = new MarkdownDocStream(byoptfo)) {
        makeByOptOverview(byopt, new MarkdownFormat(byoptstream));
      }
      catch(IOException e) {
        LOG.exception("IO Exception writing output.", e);
        throw new RuntimeException(e);
      }
    }
    // Forcibly terminate, as some class may have spawned a thread.
    System.exit(0);
  }
public static void main ( String [ ] args ) { LoggingConfiguration . setVerbose ( Level . VERBOSE ) ; if ( args . length != 2 && args . length != 4 ) { LOG . warning ( "I need exactly two or four file names to operate!" ) ; System . exit ( 1 ) ; } if ( ! args [ 0 ] . endsWith ( ".html" ) ) { LOG . warning ( "First file name doesn't end with .html!" ) ; System . exit ( 1 ) ; } if ( ! args [ 1 ] . endsWith ( ".html" ) ) { LOG . warning ( "Second file name doesn't end with .html!" ) ; System . exit ( 1 ) ; } if ( args . length > 2 && ! args [ 2 ] . endsWith ( ".md" ) ) { LOG . warning ( "Third file name doesn't end with .md!" ) ; System . exit ( 1 ) ; } if ( args . length > 3 && ! args [ 3 ] . endsWith ( ".md" ) ) { LOG . warning ( "Fourth file name doesn't end with .md!" ) ; System . exit ( 1 ) ; } File byclsname = new File ( args [ 0 ] ) ; File byoptname = new File ( args [ 1 ] ) ; File byclsnamew = args . length >= 3 ? new File ( args [ 2 ] ) : null ; File byoptnamew = args . length >= 4 ? new File ( args [ 3 ] ) : null ; try { createDirectories ( byclsname . toPath ( ) . getParent ( ) ) ; createDirectories ( byoptname . toPath ( ) . getParent ( ) ) ; createDirectories ( byclsnamew != null ? byclsnamew . toPath ( ) . getParent ( ) : null ) ; createDirectories ( byoptnamew != null ? byoptnamew . toPath ( ) . getParent ( ) : null ) ; } catch ( IOException e ) { LOG . exception ( e ) ; System . exit ( 1 ) ; } Map < Class < ? > , List < Parameter < ? > > > byclass = new HashMap < > ( ) ; Map < OptionID , List < Pair < Parameter < ? > , Class < ? > > > > byopt = new HashMap < > ( ) ; try { buildParameterIndex ( byclass , byopt ) ; } catch ( Exception e ) { LOG . exception ( e ) ; System . exit ( 1 ) ; } try ( FileOutputStream byclassfo = new FileOutputStream ( byclsname ) ; OutputStream byclassstream = new BufferedOutputStream ( byclassfo ) ) { makeByClassOverview ( byclass , new HTMLFormat ( ) ) . writeTo ( byclassstream ) ; } catch ( IOException e ) { LOG . exception ( "IO Exception writing output." , e ) ; System . exit ( 1 ) ; } if ( byclsnamew != null ) { try ( FileOutputStream byclassfo = new FileOutputStream ( byclsnamew ) ; MarkdownDocStream byclassstream = new MarkdownDocStream ( byclassfo ) ) { makeByClassOverview ( byclass , new MarkdownFormat ( byclassstream ) ) ; } catch ( IOException e ) { LOG . exception ( "IO Exception writing output." , e ) ; System . exit ( 1 ) ; } } try ( FileOutputStream byoptfo = new FileOutputStream ( byoptname ) ; OutputStream byoptstream = new BufferedOutputStream ( byoptfo ) ) { makeByOptOverview ( byopt , new HTMLFormat ( ) ) . writeTo ( byoptstream ) ; } catch ( IOException e ) { LOG . exception ( "IO Exception writing output." , e ) ; System . exit ( 1 ) ; } if ( byoptnamew != null ) { try ( FileOutputStream byoptfo = new FileOutputStream ( byoptnamew ) ; MarkdownDocStream byoptstream = new MarkdownDocStream ( byoptfo ) ) { makeByOptOverview ( byopt , new MarkdownFormat ( byoptstream ) ) ; } catch ( IOException e ) { LOG . exception ( "IO Exception writing output." , e ) ; throw new RuntimeException ( e ) ; } } System . exit ( 0 ) ; }
@param args Command line arguments