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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 pubScript: pubScript, | 55 pubScript: pubScript, |
56 noDocs: options['no-docs'], | 56 noDocs: options['no-docs'], |
57 startPage: startPage, | 57 startPage: startPage, |
58 indentJSON: indentJSON); | 58 indentJSON: indentJSON); |
59 } | 59 } |
60 | 60 |
61 /** | 61 /** |
62 * 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. |
63 */ | 63 */ |
64 void _printHelpAndExit() { | 64 void _printHelpAndExit() { |
65 print(_initArgParser().usage); | 65 print(_initArgParser().getUsage()); |
66 print('Usage: dartdocgen [OPTIONS] fooDir/barFile'); | 66 print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile'); |
67 exit(0); | 67 exit(0); |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
71 * If the user seems to have given us a single package to document, use some | 71 * If the user seems to have given us a single package to document, use some |
72 * reasonable arguments for what they probably meant. | 72 * reasonable arguments for what they probably meant. |
73 */ | 73 */ |
74 bool _singlePackage(List files) { | 74 bool _singlePackage(List files) { |
75 if (files.length != 1) return false; | 75 if (files.length != 1) return false; |
76 var pubspec = new File(path.join(files.first, 'pubspec.yaml')); | 76 var pubspec = new File(path.join(files.first, 'pubspec.yaml')); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 '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 ' |
147 '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 ' |
148 'the start page of the viewer be the intl package.', | 148 'the start page of the viewer be the intl package.', |
149 defaultsTo: null); | 149 defaultsTo: null); |
150 parser.addFlag('indent-json', | 150 parser.addFlag('indent-json', |
151 help: 'Indents each level of JSON output by two spaces', | 151 help: 'Indents each level of JSON output by two spaces', |
152 defaultsTo: false, negatable: true); | 152 defaultsTo: false, negatable: true); |
153 | 153 |
154 return parser; | 154 return parser; |
155 } | 155 } |
OLD | NEW |