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

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

Issue 10907036: Hide self-referential symlinks behind a flag in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/tests/pub/pub_install_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.');
55 return parser; 56 return parser;
56 } 57 }
57 58
58 main() { 59 main() {
59 var globalOptions; 60 var globalOptions;
60 try { 61 try {
61 globalOptions = pubArgParser.parse(new Options().arguments); 62 globalOptions = pubArgParser.parse(new Options().arguments);
62 } on FormatException catch (e) { 63 } on FormatException catch (e) {
63 printUsage(description: e.message); 64 printUsage(description: e.message);
64 return; 65 return;
65 } 66 }
66 67
67 if (globalOptions['version']) { 68 if (globalOptions['version']) {
68 printVersion(); 69 printVersion();
69 return; 70 return;
70 } 71 }
71 72
72 if (globalOptions['help'] || globalOptions.rest.isEmpty()) { 73 if (globalOptions['help'] || globalOptions.rest.isEmpty()) {
73 printUsage(); 74 printUsage();
74 return; 75 return;
75 } 76 }
76 77
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
77 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is 84 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is
78 // fixed. 85 // fixed.
79 var sdkDir = Platform.environment['DART_SDK']; 86 var sdkDir = Platform.environment['DART_SDK'];
80 var cacheDir; 87 var cacheDir;
81 if (Platform.environment.containsKey('PUB_CACHE')) { 88 if (Platform.environment.containsKey('PUB_CACHE')) {
82 cacheDir = Platform.environment['PUB_CACHE']; 89 cacheDir = Platform.environment['PUB_CACHE'];
83 } else { 90 } else {
84 // TODO(nweiz): Choose a better default for Windows. 91 // TODO(nweiz): Choose a better default for Windows.
85 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; 92 cacheDir = '${Platform.environment['HOME']}/.pub-cache';
86 } 93 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 print(''); 234 print('');
228 print('Usage: $usage'); 235 print('Usage: $usage');
229 236
230 var commandUsage = commandParser.getUsage(); 237 var commandUsage = commandParser.getUsage();
231 if (!commandUsage.isEmpty()) { 238 if (!commandUsage.isEmpty()) {
232 print(''); 239 print('');
233 print(commandUsage); 240 print(commandUsage);
234 } 241 }
235 } 242 }
236 } 243 }
OLDNEW
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/tests/pub/pub_install_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698