@@ -20,6 +20,7 @@ class DartdocProgramOptionContext extends DartdocGeneratorOptionContext
2020 : super (optionSet, dir);
2121
2222 bool get asyncStackTraces => optionSet['asyncStackTraces' ].valueAt (context);
23+ bool get generateDocs => optionSet['generateDocs' ].valueAt (context);
2324 bool get help => optionSet['help' ].valueAt (context);
2425 bool get version => optionSet['version' ].valueAt (context);
2526}
@@ -29,6 +30,10 @@ Future<List<DartdocOption>> createDartdocProgramOptions() async {
2930 new DartdocOptionArgOnly <bool >('asyncStackTraces' , false ,
3031 help: 'Display coordinated asynchronous stack traces (slow)' ,
3132 negatable: true ),
33+ new DartdocOptionArgOnly <bool >('generateDocs' , true ,
34+ help:
35+ 'Generate docs into the output directory (or only display warnings if false).' ,
36+ negatable: true ),
3237 new DartdocOptionArgOnly <bool >('help' , false ,
3338 abbr: 'h' , help: 'Show command help.' , negatable: false ),
3439 new DartdocOptionArgOnly <bool >('version' , false ,
@@ -82,29 +87,23 @@ Future<void> main(List<String> arguments) async {
8287 }
8388 startLogging (config);
8489
85- Directory outputDir = new Directory (config.output);
86- logInfo ("Generating documentation for '${config .topLevelPackageMeta }' into "
87- "${outputDir .absolute .path }${Platform .pathSeparator }" );
88-
89- Dartdoc dartdoc = await Dartdoc .withDefaultGenerators (config);
90-
90+ Dartdoc dartdoc = config.generateDocs
91+ ? await Dartdoc .withDefaultGenerators (config)
92+ : await Dartdoc .withEmptyGenerator (config);
9193 dartdoc.onCheckProgress.listen (logProgress);
9294 try {
9395 await Chain .capture (() async {
94- await runZoned (() async {
95- DartdocResults results = await dartdoc.generateDocs ();
96- logInfo ('Success! Docs generated into ${results .outDir .absolute .path }' );
97- },
96+ await runZoned (dartdoc.generateDocs,
9897 zoneSpecification: new ZoneSpecification (
9998 print: (Zone self, ZoneDelegate parent, Zone zone, String line) =>
10099 logPrint (line)));
101100 }, onError: (e, Chain chain) {
102101 if (e is DartdocFailure ) {
103- stderr.writeln ('\n Generation failed: ${e }.' );
102+ stderr.writeln ('\n dartdoc failed: ${e }.' );
104103 exitCode = 1 ;
105104 return ;
106105 } else {
107- stderr.writeln ('\n Generation failed: ${e }\n ${chain .terse }' );
106+ stderr.writeln ('\n dartdoc failed: ${e }\n ${chain .terse }' );
108107 exitCode = 255 ;
109108 return ;
110109 }
0 commit comments