Index: sdk/lib/_internal/pub/lib/src/command.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart |
index 82e66c7823e5b1bb75c021343512963fc3d23bcb..c6a55380f320ff258fffacd544212961747a2335 100644 |
--- a/sdk/lib/_internal/pub/lib/src/command.dart |
+++ b/sdk/lib/_internal/pub/lib/src/command.dart |
@@ -14,6 +14,7 @@ import 'command/build.dart'; |
import 'command/cache.dart'; |
import 'command/deps.dart'; |
import 'command/get.dart'; |
+import 'command/global.dart'; |
import 'command/help.dart'; |
import 'command/lish.dart'; |
import 'command/list_package_dirs.dart'; |
@@ -26,6 +27,7 @@ import 'entrypoint.dart'; |
import 'exceptions.dart'; |
import 'exit_codes.dart' as exit_codes; |
import 'log.dart' as log; |
+import 'global_packages.dart'; |
import 'system_cache.dart'; |
import 'utils.dart'; |
@@ -95,7 +97,11 @@ abstract class PubCommand { |
return buffer.toString(); |
} |
- SystemCache cache; |
+ SystemCache get cache => _cache; |
+ SystemCache _cache; |
+ |
+ GlobalPackages get globals => _globals; |
+ GlobalPackages _globals; |
/// The parsed options for this command. |
ArgResults get commandOptions => _commandOptions; |
@@ -170,7 +176,8 @@ abstract class PubCommand { |
Future run(String cacheDir, ArgResults options) { |
_commandOptions = options; |
- cache = new SystemCache.withSources(cacheDir, isOffline: isOffline); |
+ _cache = new SystemCache.withSources(cacheDir, isOffline: isOffline); |
+ _globals = new GlobalPackages(_cache); |
if (requiresEntrypoint) { |
// TODO(rnystrom): Will eventually need better logic to walk up |
@@ -209,14 +216,6 @@ abstract class PubCommand { |
throw new UsageException(message, _getUsage()); |
} |
- /// Throw a [DataException] with [message] to indicate that the command has |
- /// failed because of invalid input data. |
- /// |
- /// This will report the error and cause pub to exit with [exit_codes.DATA]. |
- void dataError(String message) { |
- throw new DataException(message); |
- } |
- |
/// Parses a user-supplied integer [intString] named [name]. |
/// |
/// If the parsing fails, prints a usage message and exits. |
@@ -252,9 +251,10 @@ _initCommands() { |
var commands = { |
'build': new BuildCommand(), |
'cache': new CacheCommand(), |
+ 'deps': new DepsCommand(), |
+ 'global': new GlobalCommand(), |
'get': new GetCommand(), |
'help': new HelpCommand(), |
- 'deps': new DepsCommand(), |
'list-package-dirs': new ListPackageDirsCommand(), |
'publish': new LishCommand(), |
'run': new RunCommand(), |