Skip to content

Commit bcc0043

Browse files
jcollins-gsimolus3
andauthored
Migrate dartdoc_options.dart (#2749)
* Switch to using CompilationUnitElement.classes (#2743) * Prepare dartdoc_options for migration (#2745) * more specific imports in options * do not allow autoinitialization * dartfmt * parameterize the valueWithContext type * Use alternative constructors instead of externalizing, didn't realize the autodetect was so widely used * more subclasses * flatten * Disable the unstable template checks and prepare for 2.14 stable. (#2752) * Disable one of the template checks? and add beta branch for testing * beta is the new stable * empty commit - force check reset * Add a blurb to the README about requiring analysis (#2753) * Allow comment references on generic typedefs (#2756) Co-authored-by: Janice Collins <[email protected]> * Prepare for dartdoc 2.0.0 (#2754) * Prepare for dartdoc 2.0.0 * Update changelog for additional bugfix * review comments Co-authored-by: Simon Binder <[email protected]>
1 parent 952d837 commit bcc0043

12 files changed

+244
-281
lines changed

lib/options.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import 'package:dartdoc/src/package_meta.dart';
1010

1111
/// Helper class that consolidates option contexts for instantiating generators.
1212
class DartdocGeneratorOptionContext extends DartdocOptionContext {
13-
DartdocGeneratorOptionContext(DartdocOptionSet optionSet, Folder? dir,
14-
ResourceProvider resourceProvider)
13+
DartdocGeneratorOptionContext(
14+
DartdocOptionSet optionSet, Folder dir, ResourceProvider resourceProvider)
1515
: super(optionSet, dir, resourceProvider);
1616
DartdocGeneratorOptionContext.fromDefaultContextLocation(
1717
DartdocOptionSet optionSet, ResourceProvider resourceProvider)
@@ -51,8 +51,8 @@ class DartdocGeneratorOptionContext extends DartdocOptionContext {
5151

5252
class DartdocProgramOptionContext extends DartdocGeneratorOptionContext
5353
with LoggingContext {
54-
DartdocProgramOptionContext(DartdocOptionSet optionSet, Folder? dir,
55-
ResourceProvider resourceProvider)
54+
DartdocProgramOptionContext(
55+
DartdocOptionSet optionSet, Folder dir, ResourceProvider resourceProvider)
5656
: super(optionSet, dir, resourceProvider);
5757
DartdocProgramOptionContext.fromDefaultContextLocation(
5858
DartdocOptionSet optionSet, ResourceProvider resourceProvider)
@@ -84,7 +84,7 @@ Future<DartdocProgramOptionContext?> parseOptions(
8484
List<String> arguments, {
8585
OptionGenerator? additionalOptions,
8686
}) async {
87-
var optionSet = await DartdocOptionSet.fromOptionGenerators(
87+
var optionRoot = await DartdocOptionRoot.fromOptionGenerators(
8888
'dartdoc',
8989
[
9090
createDartdocOptions,
@@ -96,35 +96,35 @@ Future<DartdocProgramOptionContext?> parseOptions(
9696
packageMetaProvider);
9797

9898
try {
99-
optionSet.parseArguments(arguments);
99+
optionRoot.parseArguments(arguments);
100100
} on FormatException catch (e) {
101101
stderr.writeln(' fatal error: ${e.message}');
102102
stderr.writeln('');
103-
_printUsage(optionSet.argParser);
103+
_printUsage(optionRoot.argParser);
104104
// Do not use exit() as this bypasses --pause-isolates-on-exit
105105
exitCode = 64;
106106
return null;
107107
}
108-
if (optionSet['help'].valueAtCurrent()) {
109-
_printHelp(optionSet.argParser);
108+
if (optionRoot['help'].valueAtCurrent()) {
109+
_printHelp(optionRoot.argParser);
110110
exitCode = 0;
111111
return null;
112112
}
113-
if (optionSet['version'].valueAtCurrent()) {
114-
_printVersion(optionSet.argParser);
113+
if (optionRoot['version'].valueAtCurrent()) {
114+
_printVersion(optionRoot.argParser);
115115
exitCode = 0;
116116
return null;
117117
}
118118

119119
DartdocProgramOptionContext config;
120120
try {
121121
config = DartdocProgramOptionContext.fromDefaultContextLocation(
122-
optionSet, packageMetaProvider.resourceProvider);
122+
optionRoot, packageMetaProvider.resourceProvider);
123123
} on DartdocOptionError catch (e) {
124124
stderr.writeln(' fatal error: ${e.message}');
125125
stderr.writeln('');
126126
await stderr.flush();
127-
_printUsage(optionSet.argParser);
127+
_printUsage(optionRoot.argParser);
128128
exitCode = 64;
129129
return null;
130130
}

0 commit comments

Comments
 (0)