| 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'; |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 import 'dart:math'; | 12 import 'dart:math'; |
| 13 import 'http.dart'; |
| 13 import 'io.dart'; | 14 import 'io.dart'; |
| 14 import 'command_help.dart'; | 15 import 'command_help.dart'; |
| 15 import 'command_install.dart'; | 16 import 'command_install.dart'; |
| 16 import 'command_lish.dart'; | 17 import 'command_lish.dart'; |
| 17 import 'command_update.dart'; | 18 import 'command_update.dart'; |
| 19 import 'command_uploader.dart'; |
| 18 import 'command_version.dart'; | 20 import 'command_version.dart'; |
| 19 import 'entrypoint.dart'; | 21 import 'entrypoint.dart'; |
| 20 import 'exit_codes.dart' as exit_codes; | 22 import 'exit_codes.dart' as exit_codes; |
| 21 import 'log.dart' as log; | 23 import 'log.dart' as log; |
| 22 import 'package.dart'; | 24 import 'package.dart'; |
| 23 import 'path.dart' as path; | 25 import 'path.dart' as path; |
| 24 import 'pubspec.dart'; | 26 import 'pubspec.dart'; |
| 25 import 'source.dart'; | 27 import 'source.dart'; |
| 26 import 'source_registry.dart'; | 28 import 'source_registry.dart'; |
| 27 import 'system_cache.dart'; | 29 import 'system_cache.dart'; |
| 28 import 'utils.dart'; | 30 import 'utils.dart'; |
| 29 import 'version.dart'; | 31 import 'version.dart'; |
| 30 | 32 |
| 31 Version get pubVersion => new Version(0, 0, 0); | 33 Version get pubVersion => new Version(0, 0, 0); |
| 32 | 34 |
| 33 /** | 35 /** |
| 34 * The commands that Pub understands. | 36 * The commands that Pub understands. |
| 35 */ | 37 */ |
| 36 Map<String, PubCommand> get pubCommands { | 38 Map<String, PubCommand> get pubCommands { |
| 37 var commands = { | 39 var commands = { |
| 38 'help': new HelpCommand(), | 40 'help': new HelpCommand(), |
| 39 'install': new InstallCommand(), | 41 'install': new InstallCommand(), |
| 40 'publish': new LishCommand(), | 42 'publish': new LishCommand(), |
| 41 'update': new UpdateCommand(), | 43 'update': new UpdateCommand(), |
| 44 'uploader': new UploaderCommand(), |
| 42 'version': new VersionCommand() | 45 'version': new VersionCommand() |
| 43 }; | 46 }; |
| 44 for (var command in commands.values) { | 47 for (var command in commands.values) { |
| 45 for (var alias in command.aliases) { | 48 for (var alias in command.aliases) { |
| 46 commands[alias] = command; | 49 commands[alias] = command; |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 return commands; | 52 return commands; |
| 50 } | 53 } |
| 51 | 54 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (exception is HttpException || exception is HttpParserException || | 317 if (exception is HttpException || exception is HttpParserException || |
| 315 exception is SocketIOException || exception is PubHttpException) { | 318 exception is SocketIOException || exception is PubHttpException) { |
| 316 return exit_codes.UNAVAILABLE; | 319 return exit_codes.UNAVAILABLE; |
| 317 } else if (exception is FormatException) { | 320 } else if (exception is FormatException) { |
| 318 return exit_codes.DATA; | 321 return exit_codes.DATA; |
| 319 } else { | 322 } else { |
| 320 return 1; | 323 return 1; |
| 321 } | 324 } |
| 322 } | 325 } |
| 323 } | 326 } |
| OLD | NEW |