Chromium Code Reviews| Index: pkg/docgen/bin/docgen.dart |
| diff --git a/pkg/docgen/bin/docgen.dart b/pkg/docgen/bin/docgen.dart |
| index df6ce632d55f20297103d3a7db5b599122fe06e3..6c6bbcca96c943f0dea85816cd20064a94f802b8 100644 |
| --- a/pkg/docgen/bin/docgen.dart |
| +++ b/pkg/docgen/bin/docgen.dart |
| @@ -15,15 +15,27 @@ import '../lib/docgen.dart'; |
| */ |
| void main() { |
| logger.onRecord.listen((record) => print(record.message)); |
| - var results = initArgParser().parse(new Options().arguments); |
| - if (results['help']) return; |
| - docgen(results); |
| + var results = _initArgParser().parse(new Options().arguments); |
| + |
| + var outputToYaml = results['yaml'] || results['output-format'] == 'yaml'; |
| + var outputToJson = results['json'] || results['output-format'] == 'json'; |
| + if (outputToYaml && outputToJson) { |
|
Emily Fortuna
2013/07/02 23:44:23
I stand by what I said before. Either just have on
janicejl
2013/07/02 23:55:36
Done.
|
| + throw new ArgumentError('Cannot have contradictory output flags.'); |
| + } |
| + outputToYaml = outputToYaml || !outputToJson; |
| + |
| + docgen(results.rest, |
| + packageRoot: results['package-root'], |
| + outputToYaml: outputToYaml, |
| + includePrivate: results['include-private'], |
| + includeSdk: results['parse-sdk'] || results['include-sdk'], |
| + parseSdk: results['parse-sdk']); |
| } |
| /** |
| * Creates parser for docgen command line arguments. |
| */ |
| -ArgParser initArgParser() { |
| +ArgParser _initArgParser() { |
| var parser = new ArgParser(); |
| parser.addFlag('help', abbr: 'h', |
| help: 'Prints help and usage information.', |
| @@ -32,6 +44,7 @@ ArgParser initArgParser() { |
| if (help) { |
| logger.info(parser.getUsage()); |
| logger.info(USAGE); |
| + exit(0); |
| } |
| }); |
| parser.addFlag('verbose', abbr: 'v', |