private static int generateNavPage(Config config, CommandSpec spec) throws IOException {

        // generate navigation
    

        if (!mkdirs(config, new File(config.directory, "partials"))) {
            return CommandLine.ExitCode.SOFTWARE;
        }

        File manpage = new File(config.directory, "partials/" + makeNavFileName(spec));
        config.verbose("Generating navigation index %s%n", manpage);

        OutputStreamWriter writer = null;
        PrintWriter pw = null;
        try {
            writer = new OutputStreamWriter(new FileOutputStream(manpage), "UTF-8");
            pw = new PrintWriter(writer);
            spec.commandLine().setColorScheme(PLAIN_SCHEME);

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

            generateNavForHelp("", pw, spec.commandLine().getHelp());
            generateSingleNav(spec, "", pw);

        } 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