takeAllArgs function
ArgResults
takeAllArgs(
- ArgParser parser,
- ArgResults results
Return a parsed ArgResults
that includes the option args (flags, single
options, and multi options) supported by parser
as well as any positional
args.
Option args not supported by parser
will be excluded.
Use this with a CompoundTool to indicate which tool should receive the positional args given to the compound target.
// tool/dart_dev/config.dart
import 'package:dart_dev/dart_dev.dart';
final config = {
'test': CompoundTool()
// This tool will not receive any positional args
..addTool(startServerTool)
// This tool will receive the test-specific option args as well as
// any positional args given to `ddev test`.
..addTool(TestTool(), argMapper: takeAllArgs)
};
Implementation
ArgResults takeAllArgs(ArgParser parser, ArgResults results) => parser.parse([
...optionArgsOnly(results, allowedOptions: parser.options.keys),
...restArgsWithSeparator(results),
]);