@@ -9,8 +9,8 @@ import 'dart:io';
99import 'package:args/args.dart' ;
1010import 'package:cli_util/cli_util.dart' as cli_util;
1111import 'package:dartdoc/dartdoc.dart' ;
12- import 'package:dartdoc/src/package_meta.dart' ;
1312import 'package:dartdoc/src/config.dart' ;
13+ import 'package:dartdoc/src/package_meta.dart' ;
1414import 'package:path/path.dart' as path;
1515import 'package:stack_trace/stack_trace.dart' ;
1616
@@ -68,21 +68,24 @@ main(List<String> arguments) async {
6868 exit (1 );
6969 }
7070
71- List <String > excludeLibraries =
72- args['exclude' ] == null ? [] : args['exclude' ].split (',' );
73- List <String > includeLibraries =
74- args['include' ] == null ? [] : args['include' ].split (',' );
71+ List <String > excludeLibraries = args['exclude' ];
72+ List <String > includeLibraries = args['include' ];
73+ List <String > includeExternals = args['include-external' ];
7574
7675 String url = args['hosted-url' ];
77- String footerFilePath = _resolveTildePath (args['footer' ]);
78- if (footerFilePath != null && ! new File (footerFilePath).existsSync ()) {
79- print ("Error: unable to locate the file with footer at ${footerFilePath }." );
80- exit (1 );
76+ List <String > footerFilePaths = args['footer' ].map (_resolveTildePath).toList ();
77+ for (String footerFilePath in footerFilePaths) {
78+ if (! new File (footerFilePath).existsSync ()) {
79+ print ("Error: unable to locate footer file: ${footerFilePath }." );
80+ exit (1 );
81+ }
8182 }
82- String headerFilePath = _resolveTildePath (args['header' ]);
83- if (headerFilePath != null && ! new File (headerFilePath).existsSync ()) {
84- print ("Error: unable to locate the file with header at ${headerFilePath }." );
85- exit (1 );
83+ List <String > headerFilePaths = args['header' ].map (_resolveTildePath).toList ();
84+ for (String headerFilePath in footerFilePaths) {
85+ if (! new File (headerFilePath).existsSync ()) {
86+ print ("Error: unable to locate header file: ${headerFilePath }." );
87+ exit (1 );
88+ }
8689 }
8790
8891 Directory outputDir =
@@ -112,7 +115,7 @@ main(List<String> arguments) async {
112115 print ('' );
113116
114117 var generators = await initGenerators (
115- url, headerFilePath, footerFilePath , args['rel-canonical-prefix' ]);
118+ url, headerFilePaths, footerFilePaths , args['rel-canonical-prefix' ]);
116119
117120 for (var generator in generators) {
118121 generator.onFileCreated.listen (_onProgress);
@@ -124,7 +127,8 @@ main(List<String> arguments) async {
124127 initializeConfig (addCrossdart: addCrossdart, includeSource: includeSource);
125128
126129 var dartdoc = new DartDoc (inputDir, excludeLibraries, sdkDir, generators,
127- outputDir, packageMeta, includeLibraries);
130+ outputDir, packageMeta, includeLibraries,
131+ includeExternals: includeExternals);
128132
129133 Chain .capture (() async {
130134 DartDocResults results = await dartdoc.generateDocs ();
@@ -163,7 +167,7 @@ ArgParser _createArgsParser() {
163167 parser.addFlag ('version' ,
164168 help: 'Display the version for $name .' , negatable: false );
165169 parser.addFlag ('add-crossdart' ,
166- help: 'Add Crossdart links to the source code pieces' ,
170+ help: 'Add Crossdart links to the source code pieces. ' ,
167171 negatable: false ,
168172 defaultsTo: false );
169173 parser.addOption ('dart-sdk' ,
@@ -181,26 +185,25 @@ ArgParser _createArgsParser() {
181185 parser.addOption ('output' ,
182186 help: 'Path to output directory.' , defaultsTo: defaultOutDir);
183187 parser.addOption ('header' ,
184- help:
185- 'path to file containing HTML text, inserted into the header of every page.' );
188+ allowMultiple: true , help: 'path to file containing HTML text.' );
186189 parser.addOption ('footer' ,
187- help:
188- 'path to file containing HTML text, inserted into the footer of every page.' );
190+ allowMultiple: true , help: 'path to file containing HTML text.' );
189191 parser.addOption ('exclude' ,
190- help : 'Comma-separated list of library names to ignore. ' );
192+ allowMultiple : true , help : ' library names to ignore' );
191193 parser.addOption ('include' ,
192- help: 'Comma-separated list of library names to generate docs for.' );
194+ allowMultiple: true , help: 'library names to generate docs for' );
195+ parser.addOption ('include-external' ,
196+ allowMultiple: true , help: 'additional (external) libraries to include' );
193197 parser.addOption ('hosted-url' ,
194198 help:
195199 'URL where the docs will be hosted (used to generate the sitemap).' );
196200 parser.addOption ('rel-canonical-prefix' ,
197- help: 'If provided, add a rel="canonical" prefixed with provided value. '
201+ help:
202+ 'If provided, add a rel="canonical" prefixed with provided value. \n '
198203 'Consider using if building many versions of the docs for public SEO. '
199- 'Learn more at https://goo.gl/gktN6F' );
204+ 'Learn more at https://goo.gl/gktN6F. ' );
200205 parser.addFlag ('include-source' ,
201- help: 'If source code blocks should be shown, if they exist.' ,
202- negatable: true ,
203- defaultsTo: true );
206+ help: 'Show source code blocks' , negatable: true , defaultsTo: true );
204207 return parser;
205208}
206209
0 commit comments