Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: lib/src/command/run.dart

Issue 1272813003: Support "--checked" in pub run and global run. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: Revise. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/command/global_run.dart ('k') | lib/src/executable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub.command.run; 5 library pub.command.run;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
11 11
12 import '../command.dart'; 12 import '../command.dart';
13 import '../executable.dart'; 13 import '../executable.dart';
14 import '../io.dart'; 14 import '../io.dart';
15 import '../utils.dart'; 15 import '../utils.dart';
16 16
17 /// Handles the `run` pub command. 17 /// Handles the `run` pub command.
18 class RunCommand extends PubCommand { 18 class RunCommand extends PubCommand {
19 String get name => "run"; 19 String get name => "run";
20 String get description => "Run an executable from a package."; 20 String get description => "Run an executable from a package.";
21 String get invocation => "pub run <executable> [args...]"; 21 String get invocation => "pub run <executable> [args...]";
22 bool get allowTrailingOptions => false; 22 bool get allowTrailingOptions => false;
23 23
24 RunCommand() { 24 RunCommand() {
25 argParser.addFlag("checked", abbr: "c",
26 help: "Enable runtime type checks and assertions.");
25 argParser.addOption("mode", 27 argParser.addOption("mode",
26 help: 'Mode to run transformers in.\n' 28 help: 'Mode to run transformers in.\n'
27 '(defaults to "release" for dependencies, "debug" for ' 29 '(defaults to "release" for dependencies, "debug" for '
28 'entrypoint)'); 30 'entrypoint)');
29 } 31 }
30 32
31 Future run() async { 33 Future run() async {
32 if (argResults.rest.isEmpty) { 34 if (argResults.rest.isEmpty) {
33 usageException("Must specify an executable to run."); 35 usageException("Must specify an executable to run.");
34 } 36 }
(...skipping 24 matching lines...) Expand all
59 var mode; 61 var mode;
60 if (argResults['mode'] != null) { 62 if (argResults['mode'] != null) {
61 mode = new BarbackMode(argResults['mode']); 63 mode = new BarbackMode(argResults['mode']);
62 } else if (package == entrypoint.root.name) { 64 } else if (package == entrypoint.root.name) {
63 mode = BarbackMode.DEBUG; 65 mode = BarbackMode.DEBUG;
64 } else { 66 } else {
65 mode = BarbackMode.RELEASE; 67 mode = BarbackMode.RELEASE;
66 } 68 }
67 69
68 var exitCode = await runExecutable(entrypoint, package, executable, args, 70 var exitCode = await runExecutable(entrypoint, package, executable, args,
69 mode: mode); 71 checked: argResults['checked'], mode: mode);
70 await flushThenExit(exitCode); 72 await flushThenExit(exitCode);
71 } 73 }
72 } 74 }
OLDNEW
« no previous file with comments | « lib/src/command/global_run.dart ('k') | lib/src/executable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698