1 | import { HelpPrinter } from "../internal/cli/HelpPrinter";
|
2 | import { BUIDLER_EXECUTABLE_NAME, BUIDLER_NAME } from "../internal/constants";
|
3 | import { task } from "../internal/core/config/config-env";
|
4 | import { BUIDLER_PARAM_DEFINITIONS } from "../internal/core/params/buidler-params";
|
5 | import { getPackageJson } from "../internal/util/packageInfo";
|
6 |
|
7 | import { TASK_HELP } from "./task-names";
|
8 |
|
9 | export default function () {
|
10 | task(TASK_HELP, "Prints this message")
|
11 | .addOptionalPositionalParam(
|
12 | "task",
|
13 | "An optional task to print more info about"
|
14 | )
|
15 | .setAction(async ({ task: taskName }: { task?: string }, { tasks }) => {
|
16 | const packageJson = await getPackageJson();
|
17 |
|
18 | const helpPrinter = new HelpPrinter(
|
19 | BUIDLER_NAME,
|
20 | BUIDLER_EXECUTABLE_NAME,
|
21 | packageJson.version,
|
22 | BUIDLER_PARAM_DEFINITIONS,
|
23 | tasks
|
24 | );
|
25 |
|
26 | if (taskName !== undefined) {
|
27 | helpPrinter.printTaskHelp(taskName);
|
28 | return;
|
29 | }
|
30 |
|
31 | helpPrinter.printGlobalHelp();
|
32 | });
|
33 | }
|