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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 if (args.isEmpty) { | 201 if (args.isEmpty) { |
202 print('No arguments provided.'); | 202 print('No arguments provided.'); |
203 print(USAGE); | 203 print(USAGE); |
204 print(argParser.getUsage()); | 204 print(argParser.getUsage()); |
205 exit(1); | 205 exit(1); |
206 } | 206 } |
207 | 207 |
208 final entrypoints = <Uri>[]; | 208 final entrypoints = <Uri>[]; |
209 try { | 209 try { |
210 final option = argParser.parse(args); | 210 final option = argParser.parse(args, allowTrailingOptions: true); |
211 | 211 |
212 // This checks to see if the root of all entrypoints is the same. | 212 // This checks to see if the root of all entrypoints is the same. |
213 // If it is not, then we display a warning, as package imports might fail. | 213 // If it is not, then we display a warning, as package imports might fail. |
214 var entrypointRoot; | 214 var entrypointRoot; |
215 for (final entrypoint in option.rest) { | 215 for (final entrypoint in option.rest) { |
216 var uri = Uri.parse(entrypoint); | 216 var uri = Uri.parse(entrypoint); |
217 if (uri.scheme == '') uri = path.toUri(entrypoint); | 217 if (uri.scheme == '') uri = path.toUri(entrypoint); |
218 entrypoints.add(uri); | 218 entrypoints.add(uri); |
219 | 219 |
220 if (uri.scheme != 'file') continue; | 220 if (uri.scheme != 'file') continue; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // If there is not, then check if the entrypoint is somewhere in a `lib` | 281 // If there is not, then check if the entrypoint is somewhere in a `lib` |
282 // directory. | 282 // directory. |
283 var parts = path.split(path.dirname(script)); | 283 var parts = path.split(path.dirname(script)); |
284 var libDir = parts.lastIndexOf('lib'); | 284 var libDir = parts.lastIndexOf('lib'); |
285 if (libDir > 0) { | 285 if (libDir > 0) { |
286 return path.join(path.joinAll(parts.take(libDir)), 'packages'); | 286 return path.join(path.joinAll(parts.take(libDir)), 'packages'); |
287 } else { | 287 } else { |
288 return null; | 288 return null; |
289 } | 289 } |
290 } | 290 } |
OLD | NEW |