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

Side by Side Diff: lib/src/command_runner.dart

Issue 1267853002: Add verbosity levels for warnings and errors. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: 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 | « no previous file | lib/src/git.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_runner; 5 library pub.command_runner;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:args/args.dart'; 10 import 'package:args/args.dart';
(...skipping 27 matching lines...) Expand all
38 "documentation."; 38 "documentation.";
39 39
40 PubCommandRunner() 40 PubCommandRunner()
41 : super("pub", "Pub is a package manager for Dart.") { 41 : super("pub", "Pub is a package manager for Dart.") {
42 argParser.addFlag('version', negatable: false, 42 argParser.addFlag('version', negatable: false,
43 help: 'Print pub version.'); 43 help: 'Print pub version.');
44 argParser.addFlag('trace', 44 argParser.addFlag('trace',
45 help: 'Print debugging information when an error occurs.'); 45 help: 'Print debugging information when an error occurs.');
46 argParser.addOption('verbosity', 46 argParser.addOption('verbosity',
47 help: 'Control output verbosity.', 47 help: 'Control output verbosity.',
48 allowed: ['normal', 'io', 'solver', 'all'], 48 allowed: ['error', 'warning', 'normal', 'io', 'solver', 'all'],
49 allowedHelp: { 49 allowedHelp: {
50 'normal': 'Show errors, warnings, and user messages.', 50 'error': 'Show only errors.',
51 'io': 'Also show IO operations.', 51 'warning': 'Show only errors and warnings.',
52 'solver': 'Show steps during version resolution.', 52 'normal': 'Show errors, warnings, and user messages.',
53 'all': 'Show all output including internal tracing messages.' 53 'io': 'Also show IO operations.',
54 'solver': 'Show steps during version resolution.',
55 'all': 'Show all output including internal tracing messages.'
54 }); 56 });
55 argParser.addFlag('verbose', abbr: 'v', negatable: false, 57 argParser.addFlag('verbose', abbr: 'v', negatable: false,
56 help: 'Shortcut for "--verbosity=all".'); 58 help: 'Shortcut for "--verbosity=all".');
57 argParser.addFlag('with-prejudice', hide: !isAprilFools, 59 argParser.addFlag('with-prejudice', hide: !isAprilFools,
58 negatable: false, help: 'Execute commands with prejudice.'); 60 negatable: false, help: 'Execute commands with prejudice.');
59 argParser.addFlag('package-symlinks', 61 argParser.addFlag('package-symlinks',
60 negatable: true, defaultsTo: true, 62 negatable: true, defaultsTo: true,
61 help: "Generate packages/ directories when installing packages."); 63 help: "Generate packages/ directories when installing packages.");
62 64
63 addCommand(new BuildCommand()); 65 addCommand(new BuildCommand());
(...skipping 28 matching lines...) Expand all
92 if (options['version']) { 94 if (options['version']) {
93 log.message('Pub ${sdk.version}'); 95 log.message('Pub ${sdk.version}');
94 return; 96 return;
95 } 97 }
96 98
97 if (options['trace']) { 99 if (options['trace']) {
98 log.recordTranscript(); 100 log.recordTranscript();
99 } 101 }
100 102
101 switch (options['verbosity']) { 103 switch (options['verbosity']) {
102 case 'normal': log.verbosity = log.Verbosity.NORMAL; break; 104 case 'error': log.verbosity = log.Verbosity.ERROR; break;
103 case 'io': log.verbosity = log.Verbosity.IO; break; 105 case 'warning': log.verbosity = log.Verbosity.WARNING; break;
104 case 'solver': log.verbosity = log.Verbosity.SOLVER; break; 106 case 'normal': log.verbosity = log.Verbosity.NORMAL; break;
105 case 'all': log.verbosity = log.Verbosity.ALL; break; 107 case 'io': log.verbosity = log.Verbosity.IO; break;
108 case 'solver': log.verbosity = log.Verbosity.SOLVER; break;
109 case 'all': log.verbosity = log.Verbosity.ALL; break;
106 default: 110 default:
107 // No specific verbosity given, so check for the shortcut. 111 // No specific verbosity given, so check for the shortcut.
108 if (options['verbose']) log.verbosity = log.Verbosity.ALL; 112 if (options['verbose']) log.verbosity = log.Verbosity.ALL;
109 break; 113 break;
110 } 114 }
111 115
112 log.fine('Pub ${sdk.version}'); 116 log.fine('Pub ${sdk.version}');
113 117
114 await _validatePlatform(); 118 await _validatePlatform();
115 119
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Future _validatePlatform() async { 179 Future _validatePlatform() async {
176 if (Platform.operatingSystem != 'windows') return; 180 if (Platform.operatingSystem != 'windows') return;
177 181
178 var result = await runProcess('ver', []); 182 var result = await runProcess('ver', []);
179 if (result.stdout.join('\n').contains('XP')) { 183 if (result.stdout.join('\n').contains('XP')) {
180 log.error('Sorry, but pub is not supported on Windows XP.'); 184 log.error('Sorry, but pub is not supported on Windows XP.');
181 await flushThenExit(exit_codes.USAGE); 185 await flushThenExit(exit_codes.USAGE);
182 } 186 }
183 } 187 }
184 } 188 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/git.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698