| 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'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 docgen(results.rest.map(path.normalize).toList(), | 25 docgen(results.rest.map(path.normalize).toList(), |
| 26 packageRoot: results['package-root'], | 26 packageRoot: results['package-root'], |
| 27 outputToYaml: !results['json'], | 27 outputToYaml: !results['json'], |
| 28 includePrivate: results['include-private'], | 28 includePrivate: results['include-private'], |
| 29 includeSdk: includeSdk, | 29 includeSdk: includeSdk, |
| 30 parseSdk: results['parse-sdk'], | 30 parseSdk: results['parse-sdk'], |
| 31 append: results['append'] && new Directory(results['out']).existsSync(), | 31 append: results['append'] && new Directory(results['out']).existsSync(), |
| 32 introFileName: introduction, | 32 introFileName: introduction, |
| 33 out: results['out'], | 33 out: results['out'], |
| 34 excludeLibraries: excludedLibraries, | 34 excludeLibraries: excludedLibraries, |
| 35 includeDependentPackages: results['include-dependent-packages']); | 35 includeDependentPackages: results['include-dependent-packages'], |
| 36 serve: results['serve'], |
| 37 noDocs: results['no-docs']); |
| 36 } | 38 } |
| 37 | 39 |
| 38 /** | 40 /** |
| 39 * Creates parser for docgen command line arguments. | 41 * Creates parser for docgen command line arguments. |
| 40 */ | 42 */ |
| 41 ArgParser _initArgParser() { | 43 ArgParser _initArgParser() { |
| 42 var parser = new ArgParser(); | 44 var parser = new ArgParser(); |
| 43 parser.addFlag('help', abbr: 'h', | 45 parser.addFlag('help', abbr: 'h', |
| 44 help: 'Prints help and usage information.', | 46 help: 'Prints help and usage information.', |
| 45 negatable: false, | 47 negatable: false, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 parser.addFlag('include-sdk', | 67 parser.addFlag('include-sdk', |
| 66 help: 'Flag to parse SDK Library files.', negatable: false); | 68 help: 'Flag to parse SDK Library files.', negatable: false); |
| 67 parser.addFlag('parse-sdk', | 69 parser.addFlag('parse-sdk', |
| 68 help: 'Parses the SDK libraries only.', | 70 help: 'Parses the SDK libraries only.', |
| 69 defaultsTo: false, negatable: false); | 71 defaultsTo: false, negatable: false); |
| 70 parser.addOption('package-root', | 72 parser.addOption('package-root', |
| 71 help: 'Sets the package root of the library being analyzed.'); | 73 help: 'Sets the package root of the library being analyzed.'); |
| 72 parser.addFlag('append', | 74 parser.addFlag('append', |
| 73 help: 'Append to the docs folder, library_list.json and index.txt', | 75 help: 'Append to the docs folder, library_list.json and index.txt', |
| 74 defaultsTo: false, negatable: false); | 76 defaultsTo: false, negatable: false); |
| 77 parser.addFlag('serve', help: 'Clone the documentation viewer repo locally ' |
| 78 '(if not already present) and start a simple server', defaultsTo: false, |
| 79 negatable: false); |
| 80 parser.addFlag('no-docs', help: 'Do not generate any new documentation', |
| 81 defaultsTo: false, negatable: false); |
| 75 parser.addOption('introduction', | 82 parser.addOption('introduction', |
| 76 help: 'Adds the provided markdown text file as the introduction' | 83 help: 'Adds the provided markdown text file as the introduction' |
| 77 ' for the generated documentation.', defaultsTo: ''); | 84 ' for the generated documentation.', defaultsTo: ''); |
| 78 parser.addOption('out', | 85 parser.addOption('out', |
| 79 help: 'The name of the output directory.', | 86 help: 'The name of the output directory.', |
| 80 defaultsTo: 'docs'); | 87 defaultsTo: 'docs'); |
| 81 parser.addOption('exclude-lib', | 88 parser.addOption('exclude-lib', |
| 82 help: 'Exclude the library by this name from the documentation', | 89 help: 'Exclude the library by this name from the documentation', |
| 83 allowMultiple: true, | 90 allowMultiple: true, |
| 84 callback: (libs) => excludedLibraries.addAll(libs)); | 91 callback: (libs) => excludedLibraries.addAll(libs)); |
| 85 parser.addFlag('include-dependent-packages', | 92 parser.addFlag('include-dependent-packages', |
| 86 help: 'Assumes we are documenting a single package and are running ' | 93 help: 'Assumes we are documenting a single package and are running ' |
| 87 'in the directory with its pubspec. Includes documentation for all ' | 94 'in the directory with its pubspec. Includes documentation for all ' |
| 88 'of its dependent packages.', | 95 'of its dependent packages.', |
| 89 defaultsTo: false, negatable: false); | 96 defaultsTo: false, negatable: false); |
| 90 return parser; | 97 return parser; |
| 91 } | 98 } |
| OLD | NEW |