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

Side by Side Diff: pkg/docgen/bin/docgen.dart

Issue 237863002: pkg/docgen: add --indent-json option (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | pkg/docgen/lib/src/generator.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 10
(...skipping 18 matching lines...) Expand all
29 var scriptDir = path.dirname(Platform.script.toFilePath()); 29 var scriptDir = path.dirname(Platform.script.toFilePath());
30 var introduction = includeSdk ? '' : options['introduction']; 30 var introduction = includeSdk ? '' : options['introduction'];
31 31
32 var pubScript = options['sdk'] != null ? 32 var pubScript = options['sdk'] != null ?
33 path.join(options['sdk'], 'bin', 'pub') : 'pub'; 33 path.join(options['sdk'], 'bin', 'pub') : 'pub';
34 34
35 var dartBinary = options['sdk'] != null ? 35 var dartBinary = options['sdk'] != null ?
36 path.join(options['sdk'], 'bin', 'dart') : 'dart'; 36 path.join(options['sdk'], 'bin', 'dart') : 'dart';
37 37
38 var excludedLibraries = options['exclude-lib']; 38 var excludedLibraries = options['exclude-lib'];
39 if(excludedLibraries == null) excludedLibraries = []; 39 if (excludedLibraries == null) excludedLibraries = [];
40
41 var indentJSON = options['indent-json'] as bool;
40 42
41 docgen(files, 43 docgen(files,
42 packageRoot: options['package-root'], 44 packageRoot: options['package-root'],
43 includePrivate: options['include-private'], 45 includePrivate: options['include-private'],
44 includeSdk: includeSdk, 46 includeSdk: includeSdk,
45 parseSdk: options['parse-sdk'], 47 parseSdk: options['parse-sdk'],
46 introFileName: introduction, 48 introFileName: introduction,
47 out: options['out'], 49 out: options['out'],
48 excludeLibraries: excludedLibraries, 50 excludeLibraries: excludedLibraries,
49 includeDependentPackages: options['include-dependent-packages'], 51 includeDependentPackages: options['include-dependent-packages'],
50 compile: options['compile'], 52 compile: options['compile'],
51 serve: options['serve'], 53 serve: options['serve'],
52 dartBinary: dartBinary, 54 dartBinary: dartBinary,
53 pubScript: pubScript, 55 pubScript: pubScript,
54 noDocs: options['no-docs'], 56 noDocs: options['no-docs'],
55 startPage: startPage); 57 startPage: startPage,
58 indentJSON: indentJSON);
56 } 59 }
57 60
58 /** 61 /**
59 * Print help if we are passed the help option or invalid arguments. 62 * Print help if we are passed the help option or invalid arguments.
60 */ 63 */
61 void _printHelpAndExit() { 64 void _printHelpAndExit() {
62 print(_initArgParser().getUsage()); 65 print(_initArgParser().getUsage());
63 print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile'); 66 print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile');
64 exit(0); 67 exit(0);
65 } 68 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 defaultsTo: true, negatable: true); 140 defaultsTo: true, negatable: true);
138 parser.addOption('sdk', 141 parser.addOption('sdk',
139 help: 'SDK directory', 142 help: 'SDK directory',
140 defaultsTo: null); 143 defaultsTo: null);
141 parser.addOption('start-page', 144 parser.addOption('start-page',
142 help: 'By default the viewer will start at the SDK introduction page. ' 145 help: 'By default the viewer will start at the SDK introduction page. '
143 'To start at some other page, e.g. for a package, provide the name ' 146 'To start at some other page, e.g. for a package, provide the name '
144 'of the package in this argument, e.g. --start-page=intl will make ' 147 'of the package in this argument, e.g. --start-page=intl will make '
145 'the start page of the viewer be the intl package.', 148 'the start page of the viewer be the intl package.',
146 defaultsTo: null); 149 defaultsTo: null);
150 parser.addFlag('indent-json',
151 help: 'Indents each level of JSON output by two spaces',
152 defaultsTo: false, negatable: true);
147 153
148 return parser; 154 return parser;
149 } 155 }
OLDNEW
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | pkg/docgen/lib/src/generator.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698