commit | 0732bac32cd6638495055685db576aded6e33b70 | [log] [tgz] |
---|---|---|
author | Ben Konyi <bkonyi@google.com> | Mon Sep 28 17:00:26 2020 +0000 |
committer | commit-bot@chromium.org <commit-bot@chromium.org> | Mon Sep 28 17:00:26 2020 +0000 |
tree | 34d1918b5bf02552a2892e1f236a9f46030b88ac | |
parent | 154e885bd43adb3a0636cdd636fa7c84553a1697 [diff] |
[ DartDev ] Fix issue where --help after a script name would be interpreted by 'dart run' Would prevent scripts from accepting their own '--help' option when running with DartDev. Fixes https://github.com/dart-lang/sdk/issues/43487 Change-Id: I5fca196529ae7670ee6a7c37701a5fffdad11aa1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164605 Reviewed-by: Janice Collins <jcollins@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart index 8a0a2ef..ae2ec2a 100644 --- a/pkg/dartdev/lib/src/commands/run.dart +++ b/pkg/dartdev/lib/src/commands/run.dart
@@ -179,7 +179,9 @@ // The arg.contains('.') matches a file name pattern, i.e. some 'foo.dart' if (arg.contains('.')) { argsContainFile = true; - } else if (arg == '--help' || arg == '-h' || arg == 'help') { + } else if (!argsContainFile && + (arg == '--help' || arg == '-h' || arg == 'help')) { + // Only print usage if a help flag is provided before the script name. printUsage(); return 0; }