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 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
8 * | 8 * |
9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
10 * | 10 * |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 if (args.isEmpty) { | 194 if (args.isEmpty) { |
195 print('No arguments provided.'); | 195 print('No arguments provided.'); |
196 print(USAGE); | 196 print(USAGE); |
197 print(argParser.getUsage()); | 197 print(argParser.getUsage()); |
198 exit(1); | 198 exit(1); |
199 } | 199 } |
200 | 200 |
201 final entrypoints = <Uri>[]; | 201 final entrypoints = <Uri>[]; |
202 try { | 202 try { |
203 final option = argParser.parse(args); | 203 final option = argParser.parse(args, continueParsing: true); |
204 | 204 |
205 // This checks to see if the root of all entrypoints is the same. | 205 // This checks to see if the root of all entrypoints is the same. |
206 // If it is not, then we display a warning, as package imports might fail. | 206 // If it is not, then we display a warning, as package imports might fail. |
207 var entrypointRoot; | 207 var entrypointRoot; |
208 for (final entrypoint in option.rest) { | 208 for (final entrypoint in option.rest) { |
209 var uri = Uri.parse(entrypoint); | 209 var uri = Uri.parse(entrypoint); |
210 if (uri.scheme == '') uri = pathToFileUri(entrypoint); | 210 if (uri.scheme == '') uri = pathToFileUri(entrypoint); |
211 entrypoints.add(uri); | 211 entrypoints.add(uri); |
212 | 212 |
213 if (uri.scheme != 'file') continue; | 213 if (uri.scheme != 'file') continue; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // If there is not, then check if the entrypoint is somewhere in a `lib` | 273 // If there is not, then check if the entrypoint is somewhere in a `lib` |
274 // directory. | 274 // directory. |
275 var parts = path.split(path.dirname(script)); | 275 var parts = path.split(path.dirname(script)); |
276 var libDir = parts.lastIndexOf('lib'); | 276 var libDir = parts.lastIndexOf('lib'); |
277 if (libDir > 0) { | 277 if (libDir > 0) { |
278 return path.join(path.joinAll(parts.take(libDir)), 'packages'); | 278 return path.join(path.joinAll(parts.take(libDir)), 'packages'); |
279 } else { | 279 } else { |
280 return null; | 280 return null; |
281 } | 281 } |
282 } | 282 } |
OLD | NEW |