Skip to content

Commit 96e6190

Browse files
authored
Remove unused additionalOptions parameter, other little refactorings (#3339)
1 parent f64290e commit 96e6190

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

lib/options.dart

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:io' show stderr, exitCode;
22

3-
import 'package:analyzer/file_system/file_system.dart';
43
import 'package:args/args.dart';
54
import 'package:dartdoc/dartdoc.dart' show dartdocVersion, programName;
65
import 'package:dartdoc/src/dartdoc_options.dart';
@@ -11,22 +10,21 @@ import 'package:dartdoc/src/package_meta.dart';
1110
/// Helper class that consolidates option contexts for instantiating generators.
1211
class DartdocGeneratorOptionContext extends DartdocOptionContext {
1312
DartdocGeneratorOptionContext(
14-
super.optionSet, Folder super.dir, super.resourceProvider);
13+
super.optionSet, super.dir, super.resourceProvider);
1514
DartdocGeneratorOptionContext.fromDefaultContextLocation(
1615
super.optionSet, super.resourceProvider)
1716
: super.fromDefaultContextLocation();
1817

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 =>
2120
_joinCustomTextFiles(optionSet['header'].valueAt(context));
2221

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 =>
2524
_joinCustomTextFiles(optionSet['footer'].valueAt(context));
2625

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 =>
3028
_joinCustomTextFiles(optionSet['footerText'].valueAt(context));
3129

3230
String _joinCustomTextFiles(Iterable<String> paths) => paths
@@ -40,21 +38,20 @@ class DartdocGeneratorOptionContext extends DartdocOptionContext {
4038
String? get relCanonicalPrefix =>
4139
optionSet['relCanonicalPrefix'].valueAt(context);
4240

43-
/// The 'templatesDir' dartdoc option if one was specified; otherwise `null`.
4441
String? get templatesDir => optionSet['templatesDir'].valueAt(context);
4542

4643
// TODO(jdkoren): duplicated temporarily so that GeneratorContext is enough for configuration.
4744
@override
4845
bool get useBaseHref => optionSet['useBaseHref'].valueAt(context);
4946

50-
/// The 'resourcesDir' dartdoc option if one was specified; otherwise `null`.
5147
String? get resourcesDir => optionSet['resourcesDir'].valueAt(context);
5248
}
5349

5450
class DartdocProgramOptionContext extends DartdocGeneratorOptionContext
5551
with LoggingContext {
5652
DartdocProgramOptionContext(
5753
super.optionSet, super.dir, super.resourceProvider);
54+
5855
DartdocProgramOptionContext.fromDefaultContextLocation(
5956
super.optionSet, super.resourceProvider)
6057
: super.fromDefaultContextLocation();
@@ -83,17 +80,15 @@ List<DartdocOption<bool>> createDartdocProgramOptions(
8380

8481
DartdocProgramOptionContext? parseOptions(
8582
PackageMetaProvider packageMetaProvider,
86-
List<String> arguments, {
87-
OptionGenerator? additionalOptions,
88-
}) {
83+
List<String> arguments,
84+
) {
8985
var optionRoot = DartdocOptionRoot.fromOptionGenerators(
9086
'dartdoc',
9187
[
9288
createDartdocOptions,
9389
createDartdocProgramOptions,
9490
createLoggingOptions,
9591
createGeneratorOptions,
96-
if (additionalOptions != null) additionalOptions,
9792
],
9893
packageMetaProvider);
9994

@@ -103,7 +98,7 @@ DartdocProgramOptionContext? parseOptions(
10398
stderr.writeln(' fatal error: ${e.message}');
10499
stderr.writeln('');
105100
_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`.
107102
exitCode = 64;
108103
return null;
109104
}

0 commit comments

Comments
 (0)