OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// The main entrypoint for the pub command line application. | 5 /// The main entrypoint for the pub command line application. |
6 library pub; | 6 library pub; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:math'; | 10 import 'dart:math'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ArgParser get pubArgParser { | 57 ArgParser get pubArgParser { |
58 var parser = new ArgParser(); | 58 var parser = new ArgParser(); |
59 parser.addFlag('help', abbr: 'h', negatable: false, | 59 parser.addFlag('help', abbr: 'h', negatable: false, |
60 help: 'Print this usage information.'); | 60 help: 'Print this usage information.'); |
61 parser.addFlag('version', negatable: false, | 61 parser.addFlag('version', negatable: false, |
62 help: 'Print pub version.'); | 62 help: 'Print pub version.'); |
63 parser.addFlag('trace', | 63 parser.addFlag('trace', |
64 help: 'Print debugging information when an error occurs.'); | 64 help: 'Print debugging information when an error occurs.'); |
65 parser.addOption('verbosity', | 65 parser.addOption('verbosity', |
66 help: 'Control output verbosity.', | 66 help: 'Control output verbosity.', |
67 allowed: ['normal', 'io', 'all'], | 67 allowed: ['normal', 'io', 'solver', 'all'], |
68 allowedHelp: { | 68 allowedHelp: { |
69 'normal': 'Errors, warnings, and user messages are shown.', | 69 'normal': 'Show errors, warnings, and user messages.', |
70 'io': 'IO operations are also shown.', | 70 'io': 'Also show IO operations.', |
71 'all': 'All output including internal tracing messages are shown.' | 71 'solver': 'Show steps during version resolution.', |
| 72 'all': 'Show all output including internal tracing messages.' |
72 }); | 73 }); |
73 parser.addFlag('verbose', abbr: 'v', negatable: false, | 74 parser.addFlag('verbose', abbr: 'v', negatable: false, |
74 help: 'Shortcut for "--verbosity=all"'); | 75 help: 'Shortcut for "--verbosity=all"'); |
75 return parser; | 76 return parser; |
76 } | 77 } |
77 | 78 |
78 main() { | 79 main() { |
79 var globalOptions; | 80 var globalOptions; |
80 try { | 81 try { |
81 globalOptions = pubArgParser.parse(new Options().arguments); | 82 globalOptions = pubArgParser.parse(new Options().arguments); |
(...skipping 13 matching lines...) Expand all Loading... |
95 return; | 96 return; |
96 } | 97 } |
97 | 98 |
98 if (globalOptions['trace']) { | 99 if (globalOptions['trace']) { |
99 log.recordTranscript(); | 100 log.recordTranscript(); |
100 } | 101 } |
101 | 102 |
102 switch (globalOptions['verbosity']) { | 103 switch (globalOptions['verbosity']) { |
103 case 'normal': log.showNormal(); break; | 104 case 'normal': log.showNormal(); break; |
104 case 'io': log.showIO(); break; | 105 case 'io': log.showIO(); break; |
| 106 case 'solver': log.showSolver(); break; |
105 case 'all': log.showAll(); break; | 107 case 'all': log.showAll(); break; |
106 default: | 108 default: |
107 // No specific verbosity given, so check for the shortcut. | 109 // No specific verbosity given, so check for the shortcut. |
108 if (globalOptions['verbose']) { | 110 if (globalOptions['verbose']) { |
109 log.showAll(); | 111 log.showAll(); |
110 } else { | 112 } else { |
111 log.showNormal(); | 113 log.showNormal(); |
112 } | 114 } |
113 break; | 115 break; |
114 } | 116 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (exception is HttpException || exception is HttpParserException || | 324 if (exception is HttpException || exception is HttpParserException || |
323 exception is SocketIOException || exception is PubHttpException) { | 325 exception is SocketIOException || exception is PubHttpException) { |
324 return exit_codes.UNAVAILABLE; | 326 return exit_codes.UNAVAILABLE; |
325 } else if (exception is FormatException) { | 327 } else if (exception is FormatException) { |
326 return exit_codes.DATA; | 328 return exit_codes.DATA; |
327 } else { | 329 } else { |
328 return 1; | 330 return 1; |
329 } | 331 } |
330 } | 332 } |
331 } | 333 } |
OLD | NEW |