Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Unified Diff: pkg/docgen/bin/docgen.dart

Issue 18438003: Removed ArgResult in lib/docgen.dart and removed top level variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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',
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698