1
1
import 'dart:io' show stderr, exitCode;
2
2
3
- import 'package:analyzer/file_system/file_system.dart' ;
4
3
import 'package:args/args.dart' ;
5
4
import 'package:dartdoc/dartdoc.dart' show dartdocVersion, programName;
6
5
import 'package:dartdoc/src/dartdoc_options.dart' ;
@@ -11,22 +10,21 @@ import 'package:dartdoc/src/package_meta.dart';
11
10
/// Helper class that consolidates option contexts for instantiating generators.
12
11
class DartdocGeneratorOptionContext extends DartdocOptionContext {
13
12
DartdocGeneratorOptionContext (
14
- super .optionSet, Folder super .dir, super .resourceProvider);
13
+ super .optionSet, super .dir, super .resourceProvider);
15
14
DartdocGeneratorOptionContext .fromDefaultContextLocation (
16
15
super .optionSet, super .resourceProvider)
17
16
: super .fromDefaultContextLocation ();
18
17
19
- /// Returns the joined contents of any 'header' files specified in options.
20
- late final String header =
18
+ /// The joined contents of any 'header' files specified in options.
19
+ String get header =>
21
20
_joinCustomTextFiles (optionSet['header' ].valueAt (context));
22
21
23
- /// Returns the joined contents of any 'footer' files specified in options.
24
- late final String footer =
22
+ /// The joined contents of any 'footer' files specified in options.
23
+ String get footer =>
25
24
_joinCustomTextFiles (optionSet['footer' ].valueAt (context));
26
25
27
- /// Returns the joined contents of any 'footer-text' files specified in
28
- /// options.
29
- late final String footerText =
26
+ /// The joined contents of any 'footer-text' files specified in options.
27
+ String get footerText =>
30
28
_joinCustomTextFiles (optionSet['footerText' ].valueAt (context));
31
29
32
30
String _joinCustomTextFiles (Iterable <String > paths) => paths
@@ -40,21 +38,20 @@ class DartdocGeneratorOptionContext extends DartdocOptionContext {
40
38
String ? get relCanonicalPrefix =>
41
39
optionSet['relCanonicalPrefix' ].valueAt (context);
42
40
43
- /// The 'templatesDir' dartdoc option if one was specified; otherwise `null` .
44
41
String ? get templatesDir => optionSet['templatesDir' ].valueAt (context);
45
42
46
43
// TODO(jdkoren): duplicated temporarily so that GeneratorContext is enough for configuration.
47
44
@override
48
45
bool get useBaseHref => optionSet['useBaseHref' ].valueAt (context);
49
46
50
- /// The 'resourcesDir' dartdoc option if one was specified; otherwise `null` .
51
47
String ? get resourcesDir => optionSet['resourcesDir' ].valueAt (context);
52
48
}
53
49
54
50
class DartdocProgramOptionContext extends DartdocGeneratorOptionContext
55
51
with LoggingContext {
56
52
DartdocProgramOptionContext (
57
53
super .optionSet, super .dir, super .resourceProvider);
54
+
58
55
DartdocProgramOptionContext .fromDefaultContextLocation (
59
56
super .optionSet, super .resourceProvider)
60
57
: super .fromDefaultContextLocation ();
@@ -83,17 +80,15 @@ List<DartdocOption<bool>> createDartdocProgramOptions(
83
80
84
81
DartdocProgramOptionContext ? parseOptions (
85
82
PackageMetaProvider packageMetaProvider,
86
- List <String > arguments, {
87
- OptionGenerator ? additionalOptions,
88
- }) {
83
+ List <String > arguments,
84
+ ) {
89
85
var optionRoot = DartdocOptionRoot .fromOptionGenerators (
90
86
'dartdoc' ,
91
87
[
92
88
createDartdocOptions,
93
89
createDartdocProgramOptions,
94
90
createLoggingOptions,
95
91
createGeneratorOptions,
96
- if (additionalOptions != null ) additionalOptions,
97
92
],
98
93
packageMetaProvider);
99
94
@@ -103,7 +98,7 @@ DartdocProgramOptionContext? parseOptions(
103
98
stderr.writeln (' fatal error: ${e .message }' );
104
99
stderr.writeln ('' );
105
100
_printUsage (optionRoot.argParser);
106
- // Do not use exit() as this bypasses --pause-isolates-on-exit
101
+ // Do not use ` exit()` as this bypasses ` --pause-isolates-on-exit`.
107
102
exitCode = 64 ;
108
103
return null ;
109
104
}
0 commit comments