| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 print(pubArgParser.getUsage()); | 127 print(pubArgParser.getUsage()); |
| 128 print(''); | 128 print(''); |
| 129 | 129 |
| 130 // Show the commands sorted. | 130 // Show the commands sorted. |
| 131 print('Available commands:'); | 131 print('Available commands:'); |
| 132 | 132 |
| 133 // TODO(rnystrom): A sorted map would be nice. | 133 // TODO(rnystrom): A sorted map would be nice. |
| 134 int length = 0; | 134 int length = 0; |
| 135 var names = <String>[]; | 135 var names = <String>[]; |
| 136 for (var command in pubCommands.keys) { | 136 for (var command in pubCommands.keys) { |
| 137 // Hide aliases. |
| 138 if (pubCommands[command].aliases.indexOf(command) >= 0) continue; |
| 137 length = max(length, command.length); | 139 length = max(length, command.length); |
| 138 names.add(command); | 140 names.add(command); |
| 139 } | 141 } |
| 140 | 142 |
| 141 names.sort((a, b) => a.compareTo(b)); | 143 names.sort((a, b) => a.compareTo(b)); |
| 142 | 144 |
| 143 for (var name in names) { | 145 for (var name in names) { |
| 144 print(' ${padRight(name, length)} ${pubCommands[name].description}'); | 146 print(' ${padRight(name, length)} ${pubCommands[name].description}'); |
| 145 } | 147 } |
| 146 | 148 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (exception is HttpException || exception is HttpParserException || | 286 if (exception is HttpException || exception is HttpParserException || |
| 285 exception is SocketIOException || exception is PubHttpException) { | 287 exception is SocketIOException || exception is PubHttpException) { |
| 286 return exit_codes.UNAVAILABLE; | 288 return exit_codes.UNAVAILABLE; |
| 287 } else if (exception is FormatException) { | 289 } else if (exception is FormatException) { |
| 288 return exit_codes.DATA; | 290 return exit_codes.DATA; |
| 289 } else { | 291 } else { |
| 290 return 1; | 292 return 1; |
| 291 } | 293 } |
| 292 } | 294 } |
| 293 } | 295 } |
| OLD | NEW |