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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tool/doc.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/grind.dart
diff --git a/tool/grind.dart b/tool/grind.dart
index def9d86cbd6d65f98b5d24f165c161432e983e4c..71d4e9266e1324e7b723f145519972c192d45490 100644
--- a/tool/grind.dart
+++ b/tool/grind.dart
@@ -7,19 +7,31 @@ import 'dart:io';
import 'package:grinder/grinder.dart';
import 'package:unscripted/unscripted.dart';
+import 'doc.dart';
import 'rule.dart';
main([List<String> args]) {
- addTask(new GrinderTask('rule', taskFunction: () {
- String ruleName = context.invocation.positionals.first;
- _generate(ruleName);
- },
+ _addTask('rule',
+ parser: (String name) =>
+ generateRule(name, outDir: Directory.current.path),
description: 'Generate a lint rule stub.',
- positionals: [new Positional(valueHelp: 'Name of rule to generate')]));
+ valueHelp: 'Name of rule to generate.');
+
+ _addTask('docs',
+ parser: (String outDir) => generateDocs(outDir),
+ description: 'Generate lint rule docs.',
+ valueHelp: 'Documentation `lints/` directory.');
grind(args);
}
-void _generate(String ruleName) {
- generateRule(ruleName, outDir: Directory.current.path);
+_addTask(String name, {String description, Parser parser, String valueHelp}) {
+ addTask(new GrinderTask(name, taskFunction: () {
+ String value = context.invocation.positionals.first;
+ parser(value);
+ },
+ description: description,
+ positionals: [new Positional(valueHelp: valueHelp)]));
}
+
+typedef String Parser(String);
« 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