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'; |
11 | 11 |
12 import '../../pkg/args/lib/args.dart'; | 12 import '../../pkg/args/lib/args.dart'; |
13 import '../../pkg/pathos/lib/path.dart' as path; | 13 import '../../pkg/pathos/lib/path.dart' as path; |
14 | 14 |
15 import 'command_help.dart'; | 15 import 'command_help.dart'; |
16 import 'command_install.dart'; | 16 import 'command_install.dart'; |
17 import 'command_lish.dart'; | 17 import 'command_lish.dart'; |
18 import 'command_update.dart'; | 18 import 'command_update.dart'; |
19 import 'command_uploader.dart'; | 19 import 'command_uploader.dart'; |
20 import 'command_version.dart'; | 20 import 'command_version.dart'; |
| 21 import 'command_cache.dart'; |
21 import 'entrypoint.dart'; | 22 import 'entrypoint.dart'; |
22 import 'exit_codes.dart' as exit_codes; | 23 import 'exit_codes.dart' as exit_codes; |
23 import 'http.dart'; | 24 import 'http.dart'; |
24 import 'io.dart'; | 25 import 'io.dart'; |
25 import 'log.dart' as log; | 26 import 'log.dart' as log; |
26 import 'package.dart'; | 27 import 'package.dart'; |
27 import 'pubspec.dart'; | 28 import 'pubspec.dart'; |
28 import 'sdk.dart' as sdk; | 29 import 'sdk.dart' as sdk; |
29 import 'source.dart'; | 30 import 'source.dart'; |
30 import 'source_registry.dart'; | 31 import 'source_registry.dart'; |
31 import 'system_cache.dart'; | 32 import 'system_cache.dart'; |
32 import 'utils.dart'; | 33 import 'utils.dart'; |
33 import 'version.dart'; | 34 import 'version.dart'; |
34 | 35 |
35 /// The commands that Pub understands. | 36 /// The commands that Pub understands. |
36 Map<String, PubCommand> get pubCommands { | 37 Map<String, PubCommand> get pubCommands { |
37 var commands = { | 38 var commands = { |
| 39 'cache': new CacheCommand(), |
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(), |
42 'uploader': new UploaderCommand(), | 44 'uploader': new UploaderCommand(), |
43 'version': new VersionCommand() | 45 'version': new VersionCommand() |
44 }; | 46 }; |
45 for (var command in commands.values.toList()) { | 47 for (var command in commands.values.toList()) { |
46 for (var alias in command.aliases) { | 48 for (var alias in command.aliases) { |
47 commands[alias] = command; | 49 commands[alias] = command; |
48 } | 50 } |
49 } | 51 } |
50 return commands; | 52 return commands; |
51 } | 53 } |
52 | 54 |
53 /// The parser for arguments that are global to Pub rather than specific to a | 55 /// The parser for arguments that are global to Pub rather than specific to a |
54 /// single command. | 56 /// single command. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (exception is HttpException || exception is HttpParserException || | 321 if (exception is HttpException || exception is HttpParserException || |
320 exception is SocketIOException || exception is PubHttpException) { | 322 exception is SocketIOException || exception is PubHttpException) { |
321 return exit_codes.UNAVAILABLE; | 323 return exit_codes.UNAVAILABLE; |
322 } else if (exception is FormatException) { | 324 } else if (exception is FormatException) { |
323 return exit_codes.DATA; | 325 return exit_codes.DATA; |
324 } else { | 326 } else { |
325 return 1; | 327 return 1; |
326 } | 328 } |
327 } | 329 } |
328 } | 330 } |
OLD | NEW |