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

Side by Side Diff: tool/grind.dart

Issue 2180083003: Grinder wrapper for doc generation. (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « tool/doc.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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:grinder/grinder.dart'; 7 import 'package:grinder/grinder.dart';
8 import 'package:unscripted/unscripted.dart'; 8 import 'package:unscripted/unscripted.dart';
9 9
10 import 'doc.dart';
10 import 'rule.dart'; 11 import 'rule.dart';
11 12
12 main([List<String> args]) { 13 main([List<String> args]) {
13 addTask(new GrinderTask('rule', taskFunction: () { 14 _addTask('rule',
14 String ruleName = context.invocation.positionals.first; 15 parser: (String name) =>
15 _generate(ruleName); 16 generateRule(name, outDir: Directory.current.path),
16 },
17 description: 'Generate a lint rule stub.', 17 description: 'Generate a lint rule stub.',
18 positionals: [new Positional(valueHelp: 'Name of rule to generate')])); 18 valueHelp: 'Name of rule to generate.');
19
20 _addTask('docs',
21 parser: (String outDir) => generateDocs(outDir),
22 description: 'Generate lint rule docs.',
23 valueHelp: 'Documentation `lints/` directory.');
19 24
20 grind(args); 25 grind(args);
21 } 26 }
22 27
23 void _generate(String ruleName) { 28 _addTask(String name, {String description, Parser parser, String valueHelp}) {
24 generateRule(ruleName, outDir: Directory.current.path); 29 addTask(new GrinderTask(name, taskFunction: () {
30 String value = context.invocation.positionals.first;
31 parser(value);
32 },
33 description: description,
34 positionals: [new Positional(valueHelp: valueHelp)]));
25 } 35 }
36
37 typedef String Parser(String);
OLDNEW
« no previous file with comments | « tool/doc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698