| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library pub.command; | 5 library pub.command; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| 11 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; |
| 12 | 12 |
| 13 import 'command/build.dart'; | 13 import 'command/build.dart'; |
| 14 import 'command/cache.dart'; | 14 import 'command/cache.dart'; |
| 15 import 'command/deps.dart'; | 15 import 'command/deps.dart'; |
| 16 import 'command/get.dart'; | 16 import 'command/get.dart'; |
| 17 import 'command/help.dart'; | 17 import 'command/help.dart'; |
| 18 import 'command/lish.dart'; | 18 import 'command/lish.dart'; |
| 19 import 'command/list_package_dirs.dart'; | 19 import 'command/list_package_dirs.dart'; |
| 20 import 'command/run.dart'; |
| 20 import 'command/serve.dart'; | 21 import 'command/serve.dart'; |
| 21 import 'command/upgrade.dart'; | 22 import 'command/upgrade.dart'; |
| 22 import 'command/uploader.dart'; | 23 import 'command/uploader.dart'; |
| 23 import 'command/version.dart'; | 24 import 'command/version.dart'; |
| 24 import 'entrypoint.dart'; | 25 import 'entrypoint.dart'; |
| 25 import 'exit_codes.dart' as exit_codes; | 26 import 'exit_codes.dart' as exit_codes; |
| 26 import 'log.dart' as log; | 27 import 'log.dart' as log; |
| 27 import 'system_cache.dart'; | 28 import 'system_cache.dart'; |
| 28 import 'utils.dart'; | 29 import 'utils.dart'; |
| 29 | 30 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 247 |
| 247 _initCommands() { | 248 _initCommands() { |
| 248 var commands = { | 249 var commands = { |
| 249 'build': new BuildCommand(), | 250 'build': new BuildCommand(), |
| 250 'cache': new CacheCommand(), | 251 'cache': new CacheCommand(), |
| 251 'get': new GetCommand(), | 252 'get': new GetCommand(), |
| 252 'help': new HelpCommand(), | 253 'help': new HelpCommand(), |
| 253 'deps': new DepsCommand(), | 254 'deps': new DepsCommand(), |
| 254 'list-package-dirs': new ListPackageDirsCommand(), | 255 'list-package-dirs': new ListPackageDirsCommand(), |
| 255 'publish': new LishCommand(), | 256 'publish': new LishCommand(), |
| 257 'run': new RunCommand(), |
| 256 'serve': new ServeCommand(), | 258 'serve': new ServeCommand(), |
| 257 'upgrade': new UpgradeCommand(), | 259 'upgrade': new UpgradeCommand(), |
| 258 'uploader': new UploaderCommand(), | 260 'uploader': new UploaderCommand(), |
| 259 'version': new VersionCommand() | 261 'version': new VersionCommand() |
| 260 }; | 262 }; |
| 261 | 263 |
| 262 for (var command in commands.values.toList()) { | 264 for (var command in commands.values.toList()) { |
| 263 for (var alias in command.aliases) { | 265 for (var alias in command.aliases) { |
| 264 commands[alias] = command; | 266 commands[alias] = command; |
| 265 } | 267 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 303 |
| 302 /// Registers a [command] with [name] on [parser]. | 304 /// Registers a [command] with [name] on [parser]. |
| 303 void _registerCommand(String name, PubCommand command, ArgParser parser) { | 305 void _registerCommand(String name, PubCommand command, ArgParser parser) { |
| 304 parser.addCommand(name, command.commandParser); | 306 parser.addCommand(name, command.commandParser); |
| 305 | 307 |
| 306 // Recursively wire up any subcommands. | 308 // Recursively wire up any subcommands. |
| 307 command.subcommands.forEach((name, subcommand) { | 309 command.subcommands.forEach((name, subcommand) { |
| 308 _registerCommand(name, subcommand, command.commandParser); | 310 _registerCommand(name, subcommand, command.commandParser); |
| 309 }); | 311 }); |
| 310 } | 312 } |
| OLD | NEW |