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 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
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 | 40 |
41 docgen(files, | 41 docgen(files, |
42 packageRoot: options['package-root'], | 42 packageRoot: options['package-root'], |
43 outputToYaml: !options['json'], | |
44 includePrivate: options['include-private'], | 43 includePrivate: options['include-private'], |
45 includeSdk: includeSdk, | 44 includeSdk: includeSdk, |
46 parseSdk: options['parse-sdk'], | 45 parseSdk: options['parse-sdk'], |
47 append: options['append'] && new Directory(options['out']).existsSync(), | |
48 introFileName: introduction, | 46 introFileName: introduction, |
49 out: options['out'], | 47 out: options['out'], |
50 excludeLibraries: excludedLibraries, | 48 excludeLibraries: excludedLibraries, |
51 includeDependentPackages: options['include-dependent-packages'], | 49 includeDependentPackages: options['include-dependent-packages'], |
52 compile: options['compile'], | 50 compile: options['compile'], |
53 serve: options['serve'], | 51 serve: options['serve'], |
54 dartBinary: dartBinary, | 52 dartBinary: dartBinary, |
55 pubScript: pubScript, | 53 pubScript: pubScript, |
56 noDocs: options['no-docs'], | 54 noDocs: options['no-docs'], |
57 startPage: startPage); | 55 startPage: startPage); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 help: 'Prints help and usage information.', | 94 help: 'Prints help and usage information.', |
97 negatable: false, | 95 negatable: false, |
98 callback: (help) { | 96 callback: (help) { |
99 if (help) _printHelpAndExit(); | 97 if (help) _printHelpAndExit(); |
100 }); | 98 }); |
101 parser.addFlag('verbose', abbr: 'v', | 99 parser.addFlag('verbose', abbr: 'v', |
102 help: 'Output more logging information.', negatable: false, | 100 help: 'Output more logging information.', negatable: false, |
103 callback: (verbose) { | 101 callback: (verbose) { |
104 if (verbose) Logger.root.level = Level.FINEST; | 102 if (verbose) Logger.root.level = Level.FINEST; |
105 }); | 103 }); |
106 parser.addFlag('json', abbr: 'j', | |
107 help: 'Outputs to JSON. If negated, outputs to YAML. ' | |
108 'If --append is used, it takes the file-format of the previous ' | |
109 'run stated in library_list.json, ignoring the flag.', | |
110 negatable: true, defaultsTo: true); | |
111 parser.addFlag('include-private', | 104 parser.addFlag('include-private', |
112 help: 'Flag to include private declarations.', negatable: false); | 105 help: 'Flag to include private declarations.', negatable: false); |
113 parser.addFlag('include-sdk', | 106 parser.addFlag('include-sdk', |
114 help: 'Flag to parse SDK Library files.', | 107 help: 'Flag to parse SDK Library files.', |
115 defaultsTo: true, | 108 defaultsTo: true, |
116 negatable: true); | 109 negatable: true); |
117 parser.addFlag('parse-sdk', | 110 parser.addFlag('parse-sdk', |
118 help: 'Parses the SDK libraries only.', | 111 help: 'Parses the SDK libraries only.', |
119 defaultsTo: false, negatable: false); | 112 defaultsTo: false, negatable: false); |
120 parser.addOption('package-root', | 113 parser.addOption('package-root', |
121 help: 'Sets the package root of the library being analyzed.'); | 114 help: 'Sets the package root of the library being analyzed.'); |
122 parser.addFlag('append', | |
123 help: 'Append to the docs folder, library_list.json and index.txt', | |
124 defaultsTo: false, negatable: false); | |
125 parser.addFlag('compile', help: 'Clone the documentation viewer repo locally ' | 115 parser.addFlag('compile', help: 'Clone the documentation viewer repo locally ' |
126 '(if not already present) and compile with dart2js', defaultsTo: false, | 116 '(if not already present) and compile with dart2js', defaultsTo: false, |
127 negatable: false); | 117 negatable: false); |
128 parser.addFlag('serve', help: 'Clone the documentation viewer repo locally ' | 118 parser.addFlag('serve', help: 'Clone the documentation viewer repo locally ' |
129 '(if not already present), compile with dart2js, ' | 119 '(if not already present), compile with dart2js, ' |
130 'and start a simple server', | 120 'and start a simple server', |
131 defaultsTo: false, negatable: false); | 121 defaultsTo: false, negatable: false); |
132 parser.addFlag('no-docs', help: 'Do not generate any new documentation', | 122 parser.addFlag('no-docs', help: 'Do not generate any new documentation', |
133 defaultsTo: false, negatable: false); | 123 defaultsTo: false, negatable: false); |
134 parser.addOption('introduction', | 124 parser.addOption('introduction', |
(...skipping 15 matching lines...) Expand all Loading... |
150 defaultsTo: null); | 140 defaultsTo: null); |
151 parser.addOption('start-page', | 141 parser.addOption('start-page', |
152 help: 'By default the viewer will start at the SDK introduction page. ' | 142 help: 'By default the viewer will start at the SDK introduction page. ' |
153 'To start at some other page, e.g. for a package, provide the name ' | 143 'To start at some other page, e.g. for a package, provide the name ' |
154 'of the package in this argument, e.g. --start-page=intl will make ' | 144 'of the package in this argument, e.g. --start-page=intl will make ' |
155 'the start page of the viewer be the intl package.', | 145 'the start page of the viewer be the intl package.', |
156 defaultsTo: null); | 146 defaultsTo: null); |
157 | 147 |
158 return parser; | 148 return parser; |
159 } | 149 } |
OLD | NEW |