@ Override protected void processIndexTemplate ( final Configuration cfg , final List < DocWorkUnit > workUnitList , final List < Map < String , String > > groupMaps ) throws IOException { // Create a root map for all the work units so we can access all the info we need: final Map < String , Object > propertiesMap = new HashMap <> ( ) ; workUnits . stream ( ) . forEach ( workUnit -> propertiesMap . put ( workUnit . getName ( ) , workUnit . getRootMap ( ) ) ) ; // Add everything into a nice package that we can iterate over // while exposing the command line program names as keys: final Map < String , Object > rootMap = new HashMap <> ( ) ; rootMap . put ( "tools" , propertiesMap ) ; // Add the caller script options into another top-level tree node: final Map < String , Object > callerScriptOptionsMap = new HashMap <> ( ) ; callerScriptOptionsMap . put ( "callerScriptName" , callerScriptName ) ; callerScriptOptionsMap . put ( "callerScriptPrefixLegalArgs" , callerScriptPrefixLegalArgs ) ; callerScriptOptionsMap . put ( "callerScriptPrefixArgValueTypes" , callerScriptPrefixArgValueTypes ) ; callerScriptOptionsMap . put ( "callerScriptPrefixMutexArgs" , callerScriptPrefixMutexArgs ) ; callerScriptOptionsMap . put ( "callerScriptPrefixAliasArgs" , callerScriptPrefixAliasArgs ) ; callerScriptOptionsMap . put ( "callerScriptPrefixMinOccurrences" , callerScriptPrefixMinOccurrences ) ; callerScriptOptionsMap . put ( "callerScriptPrefixMaxOccurrences" , callerScriptPrefixMaxOccurrences ) ; callerScriptOptionsMap . put ( "callerScriptPostfixLegalArgs" , callerScriptPostfixLegalArgs ) ; callerScriptOptionsMap . put ( "callerScriptPostfixArgValueTypes" , callerScriptPostfixArgValueTypes ) ; callerScriptOptionsMap . put ( "callerScriptPostfixMutexArgs" , callerScriptPostfixMutexArgs ) ; callerScriptOptionsMap . put ( "callerScriptPostfixAliasArgs" , callerScriptPostfixAliasArgs ) ; callerScriptOptionsMap . put ( "callerScriptPostfixMinOccurrences" , callerScriptPostfixMinOccurrences ) ; callerScriptOptionsMap . put ( "callerScriptPostfixMaxOccurrences" , callerScriptPostfixMaxOccurrences ) ; if ( hasCallerScriptPostfixArgs ) { callerScriptOptionsMap . put ( "hasCallerScriptPostfixArgs" , "true" ) ; } else { callerScriptOptionsMap . put ( "hasCallerScriptPostfixArgs" , "false" ) ; } rootMap . put ( "callerScriptOptions" , callerScriptOptionsMap ) ; // Get or create a template final Template template = cfg . getTemplate ( getIndexTemplateName ( ) ) ; // Create the output file final File indexFile = new File ( getDestinationDir ( ) , getIndexBaseFileName ( ) + "." + getIndexFileExtension ( ) ) ; // Run the template and merge in the data try ( final FileOutputStream fileOutStream = new FileOutputStream ( indexFile ) ; final OutputStreamWriter outWriter = new OutputStreamWriter ( fileOutStream ) ) { template . process ( rootMap , outWriter ) ; } catch ( TemplateException e ) { throw new DocException ( "Freemarker Template Exception during documentation index creation" , e ) ; } }
The Index file in the Bash Completion Doclet is what generates the actual tab - completion script .