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 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'package:args/command_runner.dart'; | 8 import 'package:args/command_runner.dart'; |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 GlobalPackages _globals; | 36 GlobalPackages _globals; |
37 | 37 |
38 /// Gets the [Entrypoint] package for the current working directory. | 38 /// Gets the [Entrypoint] package for the current working directory. |
39 /// | 39 /// |
40 /// This will load the pubspec and fail with an error if the current directory | 40 /// This will load the pubspec and fail with an error if the current directory |
41 /// is not a package. | 41 /// is not a package. |
42 Entrypoint get entrypoint { | 42 Entrypoint get entrypoint { |
43 // Lazy load it. | 43 // Lazy load it. |
44 if (_entrypoint == null) { | 44 if (_entrypoint == null) { |
45 _entrypoint = new Entrypoint(path.current, cache, | 45 _entrypoint = new Entrypoint('.', cache, |
46 packageSymlinks: globalResults['package-symlinks']); | 46 packageSymlinks: globalResults['package-symlinks']); |
47 } | 47 } |
48 return _entrypoint; | 48 return _entrypoint; |
49 } | 49 } |
50 Entrypoint _entrypoint; | 50 Entrypoint _entrypoint; |
51 | 51 |
52 /// The URL for web documentation for this command. | 52 /// The URL for web documentation for this command. |
53 String get docUrl => null; | 53 String get docUrl => null; |
54 | 54 |
55 /// Override this and return `false` to disallow trailing options from being | 55 /// Override this and return `false` to disallow trailing options from being |
(...skipping 29 matching lines...) Expand all Loading... |
85 /// | 85 /// |
86 /// If the parsing fails, prints a usage message and exits. | 86 /// If the parsing fails, prints a usage message and exits. |
87 int parseInt(String intString, String name) { | 87 int parseInt(String intString, String name) { |
88 try { | 88 try { |
89 return int.parse(intString); | 89 return int.parse(intString); |
90 } on FormatException catch (_) { | 90 } on FormatException catch (_) { |
91 usageException('Could not parse $name "$intString".'); | 91 usageException('Could not parse $name "$intString".'); |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
OLD | NEW |