Unverified Commit b549e829 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] support trailing args (#86431)

parent 4d96a3fd
......@@ -249,9 +249,8 @@ class PackagesForwardCommand extends FlutterCommand {
}
class PackagesPassthroughCommand extends FlutterCommand {
PackagesPassthroughCommand() {
requiresPubspecYaml();
}
@override
ArgParser argParser = ArgParser.allowAnything();
@override
String get name => 'pub';
......
......@@ -159,7 +159,6 @@ abstract class FlutterCommand extends Command<void> {
@override
ArgParser get argParser => _argParser;
final ArgParser _argParser = ArgParser(
allowTrailingOptions: false,
usageLineLength: globals.outputPreferences.wrapText ? globals.outputPreferences.wrapColumn : null,
);
......
......@@ -1620,19 +1620,6 @@ void main() {
);
});
// Verify that we help the user correct an option ordering issue
testUsingContext('produces sensible error message', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
expect(
runner.run(<String>['create', projectDir.path, '--pub']),
throwsToolExit(exitCode: 2, message: 'Try moving --pub'),
);
});
testUsingContext('fails when file exists where output directory should be', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
......
......@@ -247,4 +247,19 @@ void main() {
'A crash report has been written to',
));
});
testWithoutContext('flutter supports trailing args', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final ProcessResult result = await processManager.run(<String>[
flutterBin,
'test',
'test/hello_test.dart',
'-r',
'json',
], workingDirectory: helloWorld);
expect(result.exitCode, 0);
expect(result.stderr, isEmpty);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment