Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: utils/pub/pub.dart

Issue 10916190: Support both new and old style package layouts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/args.dart'); 10 #import('../../pkg/args/args.dart');
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 * The parser for arguments that are global to Pub rather than specific to a 45 * The parser for arguments that are global to Pub rather than specific to a
46 * single command. 46 * single command.
47 */ 47 */
48 ArgParser get pubArgParser { 48 ArgParser get pubArgParser {
49 var parser = new ArgParser(); 49 var parser = new ArgParser();
50 parser.addFlag('help', abbr: 'h', negatable: false, 50 parser.addFlag('help', abbr: 'h', negatable: false,
51 help: 'Prints this usage information'); 51 help: 'Prints this usage information');
52 parser.addFlag('version', negatable: false, 52 parser.addFlag('version', negatable: false,
53 help: 'Prints the version of Pub'); 53 help: 'Prints the version of Pub');
54 parser.addFlag('trace', help: 'Prints a stack trace when an error occurs'); 54 parser.addFlag('trace', help: 'Prints a stack trace when an error occurs');
55 parser.addFlag('self-link', help: 'Temporary flag, do not use.');
56 return parser; 55 return parser;
57 } 56 }
58 57
59 main() { 58 main() {
60 var globalOptions; 59 var globalOptions;
61 try { 60 try {
62 globalOptions = pubArgParser.parse(new Options().arguments); 61 globalOptions = pubArgParser.parse(new Options().arguments);
63 } on FormatException catch (e) { 62 } on FormatException catch (e) {
64 printUsage(description: e.message); 63 printUsage(description: e.message);
65 return; 64 return;
66 } 65 }
67 66
68 if (globalOptions['version']) { 67 if (globalOptions['version']) {
69 printVersion(); 68 printVersion();
70 return; 69 return;
71 } 70 }
72 71
73 if (globalOptions['help'] || globalOptions.rest.isEmpty()) { 72 if (globalOptions['help'] || globalOptions.rest.isEmpty()) {
74 printUsage(); 73 printUsage();
75 return; 74 return;
76 } 75 }
77 76
78 // TODO(rnystrom): Get rid of this flag (and make the default be true) when
79 // #4820 is fixed and the Editor can handle recursive symlinks.
80 if (globalOptions['self-link']) {
81 Entrypoint.installSelfLink = true;
82 }
83
84 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is 77 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is
85 // fixed. 78 // fixed.
86 var sdkDir = Platform.environment['DART_SDK']; 79 var sdkDir = Platform.environment['DART_SDK'];
87 var cacheDir; 80 var cacheDir;
88 if (Platform.environment.containsKey('PUB_CACHE')) { 81 if (Platform.environment.containsKey('PUB_CACHE')) {
89 cacheDir = Platform.environment['PUB_CACHE']; 82 cacheDir = Platform.environment['PUB_CACHE'];
90 } else { 83 } else {
91 // TODO(nweiz): Choose a better default for Windows. 84 // TODO(nweiz): Choose a better default for Windows.
92 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; 85 cacheDir = '${Platform.environment['HOME']}/.pub-cache';
93 } 86 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 print(''); 231 print('');
239 print('Usage: $usage'); 232 print('Usage: $usage');
240 233
241 var commandUsage = commandParser.getUsage(); 234 var commandUsage = commandParser.getUsage();
242 if (!commandUsage.isEmpty()) { 235 if (!commandUsage.isEmpty()) {
243 print(''); 236 print('');
244 print(commandUsage); 237 print(commandUsage);
245 } 238 }
246 } 239 }
247 } 240 }
OLDNEW
« utils/pub/io.dart ('K') | « utils/pub/io.dart ('k') | utils/pub/sdk_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698