| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
| 8 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 9 | 9 |
| 10 import '../lib/docgen.dart'; | 10 import '../lib/docgen.dart'; |
| 11 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; | |
| 12 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; | |
| 13 | 11 |
| 14 /** | 12 /** |
| 15 * Analyzes Dart files and generates a representation of included libraries, | 13 * Analyzes Dart files and generates a representation of included libraries, |
| 16 * classes, and members. | 14 * classes, and members. |
| 17 */ | 15 */ |
| 18 void main() { | 16 void main() { |
| 19 logger.onRecord.listen((record) => print(record.message)); | 17 logger.onRecord.listen((record) => print(record.message)); |
| 20 var results = initArgParser().parse(new Options().arguments); | 18 var results = initArgParser().parse(new Options().arguments); |
| 21 if (results["help"]) return; | 19 if (results["help"]) return; |
| 22 new Docgen(results).analyze(listLibraries(results.rest)); | 20 new Docgen(results); |
| 23 } | 21 } |
| 24 | 22 |
| 25 /** | 23 /** |
| 26 * Creates parser for docgen command line arguments. | 24 * Creates parser for docgen command line arguments. |
| 27 */ | 25 */ |
| 28 ArgParser initArgParser() { | 26 ArgParser initArgParser() { |
| 29 var parser = new ArgParser(); | 27 var parser = new ArgParser(); |
| 30 parser.addFlag("help", abbr: "h", | 28 parser.addFlag("help", abbr: "h", |
| 31 help: "Prints help and usage information.", | 29 help: "Prints help and usage information.", |
| 32 negatable: false, | 30 negatable: false, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 50 help: "Same as output-format=yaml.", negatable: false); | 48 help: "Same as output-format=yaml.", negatable: false); |
| 51 parser.addFlag("json", abbr: "j", | 49 parser.addFlag("json", abbr: "j", |
| 52 help: "Same as output-format=json.", negatable: false); | 50 help: "Same as output-format=json.", negatable: false); |
| 53 parser.addFlag("include-private", | 51 parser.addFlag("include-private", |
| 54 help: "Flag to include private declarations.", negatable: false); | 52 help: "Flag to include private declarations.", negatable: false); |
| 55 parser.addFlag("include-sdk", | 53 parser.addFlag("include-sdk", |
| 56 help: "Flag to parse SDK Library files.", negatable: false); | 54 help: "Flag to parse SDK Library files.", negatable: false); |
| 57 | 55 |
| 58 return parser; | 56 return parser; |
| 59 } | 57 } |
| OLD | NEW |