From 31da68db49d95d8863f34392adf604df538d8cd5 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 10 Feb 2018 09:32:19 -0800 Subject: fix docs --- docs/extending.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'docs/extending.md') diff --git a/docs/extending.md b/docs/extending.md index 9b4656f8..299d8e76 100644 --- a/docs/extending.md +++ b/docs/extending.md @@ -148,5 +148,25 @@ builds, simply publish your code as a library to maven central. For more information, see Ammonite's [Ivy Dependencies documentation](http://ammonite.io/#import$ivy) -## Custom Main Methods +## Evaluator Commands +You can define a command that takes in the current `Evaluator` as an argument, +which you can use to inspect the entire build, or run arbitrary tasks. For +example, here is the `mill.scalalib.GenIdea/idea` command which uses this to +traverse the module-tree and generate an Intellij project config for your build. + +```scala +def idea(ev: Evaluator[Any]) = T.command{ + mill.scalalib.GenIdea( + implicitly, + ev.rootModule, + ev.discover + ) +} +``` + +Many built-in tools are implemented as custom evaluator commands: +[all](intro.html#all), [describe](intro.html#describe), +[resolve](intro.html#resolve), [show](intro.html#show). If you want a way to run Mill +commands and programmatically manipulate the tasks and outputs, you do so with +your own evaluator command. -- cgit v1.2.3