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 /** | 5 /** |
6 * The main entrypoint for the pub command line application. | 6 * The main entrypoint for the pub command line application. |
7 */ | 7 */ |
8 library pub; | 8 library pub; |
9 | 9 |
10 import '../../pkg/args/lib/args.dart'; | 10 import '../../pkg/args/lib/args.dart'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 print(''); | 114 print(''); |
115 print('Global options:'); | 115 print('Global options:'); |
116 print(pubArgParser.getUsage()); | 116 print(pubArgParser.getUsage()); |
117 print(''); | 117 print(''); |
118 print('The commands are:'); | 118 print('The commands are:'); |
119 | 119 |
120 // Show the commands sorted. | 120 // Show the commands sorted. |
121 // TODO(rnystrom): A sorted map would be nice. | 121 // TODO(rnystrom): A sorted map would be nice. |
122 int length = 0; | 122 int length = 0; |
123 var names = <String>[]; | 123 var names = <String>[]; |
124 for (var command in pubCommands.getKeys()) { | 124 for (var command in pubCommands.keys) { |
125 length = max(length, command.length); | 125 length = max(length, command.length); |
126 names.add(command); | 126 names.add(command); |
127 } | 127 } |
128 | 128 |
129 names.sort((a, b) => a.compareTo(b)); | 129 names.sort((a, b) => a.compareTo(b)); |
130 | 130 |
131 for (var name in names) { | 131 for (var name in names) { |
132 print(' ${padRight(name, length)} ${pubCommands[name].description}'); | 132 print(' ${padRight(name, length)} ${pubCommands[name].description}'); |
133 } | 133 } |
134 | 134 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if (exception is HttpException || exception is HttpParserException || | 267 if (exception is HttpException || exception is HttpParserException || |
268 exception is SocketIOException || exception is PubHttpException) { | 268 exception is SocketIOException || exception is PubHttpException) { |
269 return exit_codes.UNAVAILABLE; | 269 return exit_codes.UNAVAILABLE; |
270 } else if (exception is FormatException) { | 270 } else if (exception is FormatException) { |
271 return exit_codes.DATA; | 271 return exit_codes.DATA; |
272 } else { | 272 } else { |
273 return 1; | 273 return 1; |
274 } | 274 } |
275 } | 275 } |
276 } | 276 } |
OLD | NEW |