| 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('../../lib/args/args.dart'); | 10 #import('../../lib/args/args.dart'); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 printVersion(); | 62 printVersion(); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (globalOptions['help'] || globalOptions.rest.isEmpty()) { | 66 if (globalOptions['help'] || globalOptions.rest.isEmpty()) { |
| 67 printUsage(parser, commands); | 67 printUsage(parser, commands); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 | 70 |
| 71 var cache = new SystemCache(globalOptions['cachedir']); | 71 var cache = new SystemCache(globalOptions['cachedir']); |
| 72 cache.sources.register(new SdkSource(globalOptions['sdkdir'])); | 72 cache.register(new SdkSource(globalOptions['sdkdir'])); |
| 73 cache.sources.register(new GitSource()); | 73 cache.register(new GitSource()); |
| 74 cache.sources.register(new RepoSource()); | 74 cache.register(new RepoSource()); |
| 75 // TODO(nweiz): Make 'repo' the default once pub.dartlang.org exists | 75 // TODO(nweiz): Make 'repo' the default once pub.dartlang.org exists |
| 76 cache.sources.setDefault('sdk'); | 76 cache.sources.setDefault('sdk'); |
| 77 | 77 |
| 78 // Select the command. | 78 // Select the command. |
| 79 var command = commands[globalOptions.rest[0]]; | 79 var command = commands[globalOptions.rest[0]]; |
| 80 if (command == null) { | 80 if (command == null) { |
| 81 printError('Unknown command "${globalOptions.rest[0]}".'); | 81 printError('Unknown command "${globalOptions.rest[0]}".'); |
| 82 printError('Run "pub help" to see available commands.'); | 82 printError('Run "pub help" to see available commands.'); |
| 83 exit(64); // See http://www.freebsd.org/cgi/man.cgi?query=sysexits. | 83 exit(64); // See http://www.freebsd.org/cgi/man.cgi?query=sysexits. |
| 84 return; | 84 return; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 future.handleException((e) => handleError(e, future.stackTrace)); | 177 future.handleException((e) => handleError(e, future.stackTrace)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 /** | 180 /** |
| 181 * Override this to perform the specific command. Return a future that | 181 * Override this to perform the specific command. Return a future that |
| 182 * completes when the command is done or fails if the command fails. If the | 182 * completes when the command is done or fails if the command fails. If the |
| 183 * command is synchronous, it may return `null`. | 183 * command is synchronous, it may return `null`. |
| 184 */ | 184 */ |
| 185 abstract Future onRun(); | 185 abstract Future onRun(); |
| 186 } | 186 } |
| OLD | NEW |