static int generateManPage(Config config, CommandSpec... specs) throws IOException {
        Assert.notNull(config, "config");
        Assert.notNull(config.directory, "output directory");
        Assert.notNull(config.verbosity, "verbosity array");

        if (config.templatesDirectory != null && config.templatesDirectory.equals(config.directory)) {
            System.err.println("gen-manpage: Error: output directory must differ from the templates directory.");
            System.err.println("Try 'gen-manpage --help' for more information.");
            return CommandLine.ExitCode.USAGE;
        }

        traceAllSpecs(specs, config);

        for (CommandSpec spec : specs) {
            int result = generateSingleManPage(config, spec);
            if (result != CommandLine.ExitCode.OK) {
                return result;
            }

            Set<CommandSpec> done = new HashSet<CommandSpec>();

            // recursively create man pages for subcommands
            for (CommandLine sub : spec.subcommands().values()) {
                CommandSpec subSpec = sub.getCommandSpec();
                if (done.contains(subSpec) || subSpec.usageMessage().hidden()) {
                    continue;
                }
                done.add(subSpec);
                result = generateManPage(config, subSpec);
                if (result != CommandLine.ExitCode.OK) {
                    return result;
                }
            }
        }

        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