private static int generateCustomizableTemplate(Config config, CommandSpec spec) throws IOException {
        if (config.templatesDirectory == null) {
            return CommandLine.ExitCode.OK;
        }
        if (!mkdirs(config, config.templatesDirectory)) {
            return CommandLine.ExitCode.SOFTWARE;
        }

        File templateFile = new File(config.templatesDirectory, makeFileName(spec));
        if (templateFile.exists()) {
            if (config.force) {
                config.verbose("Overwriting existing man page template file %s...%n", templateFile);
            } else {
                System.err.printf("gen-manpage: ERROR: cannot generate man page template file %s: it already exists. "
                        + "Remove the --template-dir option or use --force to overwrite.%n", templateFile);
                System.err.println("Try 'gen-manpage --help' for more information.");
                return EXIT_CODE_TEMPLATE_EXISTS;
            }
        } else {
            config.verbose("Generating customizable man page template %s%n", templateFile);
        }

        FileWriter writer = null;
        PrintWriter pw = null;
        try {
            writer = new FileWriter(templateFile);
            pw = new PrintWriter(writer);
            writeCustomizableManPageTemplate(pw, config.directory, spec);
        } finally {
            Util.closeSilently(pw);
            Util.closeSilently(writer);
        }
        return CommandLine.ExitCode.OK;
    }
Generates AsciiDoc files for the specified classes to the specified output
directory, optionally also generating template files in the
{@code customizablePagesDirectory} directory.

@param outdir                     Output directory to write the generated
                                  AsciiDoc files to.
@param customizablePagesDirectory Optional directory to write customizable
                                  man page template files. If
                                  non-{@code null}, an additional "template"
                                  file is created here for each generated
                                  manpage AsciiDoc file.
@param verbosity                  the length of this array determines
                                  verbosity during processing
@param overwriteCustomizablePages Overwrite existing man page templates. The
                                  default is false, meaning processing is
                                  aborted and the process exits with status
                                  code 4 if a man page template file already
                                  exists.
@param specs                      the Commands to generate AsciiDoc man pages
                                  for
@return the exit code
@throws IOException if a problem occurred writing to the file system
docs/genadoc.java