DartdocOption<T extends Object?> class
abstract
An abstract class for interacting with dartdoc options.
This class and its implementations allow Dartdoc to declare options that are both defined in a configuration file and specified via the command line, with searching the directory tree for a proper file and overriding file options with the command line built-in. A number of sanity checks are also built in to these classes so that file existence can be verified, types constrained, and defaults provided.
This class caches the current working directory from the ResourceProvider
;
do not attempt to change it during the life of an instance.
Use via implementations DartdocOptionSet, DartdocOptionArgFile, DartdocOptionArgOnly, and DartdocOptionFileOnly.
Constructors
-
DartdocOption(String name, T? defaultsTo, String help, OptionKind optionIs, bool mustExist, ConvertYamlToType<
T> ? _convertYamlToType, ResourceProvider resourceProvider)
Properties
- defaultsTo → T?
-
This is the value returned if we couldn't find one otherwise.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- help → String
-
Text string for help passed on in command line options.
final
- isDir → bool
-
Set to true if this option represents the name of a directory.
no setter
- isFile → bool
-
Set to true if this option represents the name of a file.
no setter
- isGlob → bool
-
Set to true if this option represents a glob.
no setter
-
keys
→ Iterable<
String> -
All object names starting at the root.
no setter
- mustExist → bool
-
Set to true if DartdocOption subclasses should validate that the
directory or file exists. Does not imply validation of defaultsTo,
and requires that one of isDir or isFile is set.
final
- name → String
-
The name of this option, not including the names of any parents.
final
- optionIs → OptionKind
-
final
- parent ↔ DartdocOption
-
To avoid accessing early, call add on the option's parent before
looking up unless this is a DartdocOptionRoot.
latefinal
- resourceProvider → ResourceProvider
-
final
- root → DartdocOptionRoot
-
The DartdocOptionRoot containing this object.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
DartdocOption< Object?> option) → void - Adds a DartdocOption to the children of this DartdocOption.
-
addAll(
Iterable< DartdocOption< options) → voidObject?> > - Adds a list of dartdoc options to the children of this DartdocOption.
-
getValueAs<
U> (String name, Folder dir) → U -
Get the immediate child of this node named
name
and its value atdir
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseArguments(
List< String> arguments) → void - Call this with argv to set up the argument overrides. Applies to all children.
-
toString(
) → String -
A string representation of this object.
inherited
-
traverse(
void visit(DartdocOption< Object?> option)) → void -
Apply the function
visit
to this and all children. -
valueAt(
Folder dir) → dynamic - Return the calculated value of this option, given the directory as context.
-
valueAtCurrent(
) → Object? - Calls valueAt with the working directory at the start of the program.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String name) → DartdocOption< Object?> -
Get the immediate child of this node named
name
.