hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
23 lines (22 loc) • 1.13 kB
JavaScript
import { getHardhatVersion } from "../../utils/package.js";
import { GLOBAL_NAME_PADDING, getLongestNameLength, getSection, parseTasks, parseGlobalOptions, } from "./utils.js";
export async function getGlobalHelpString(rootTasks, globalOptionDefinitions) {
const version = await getHardhatVersion();
const { tasks, subtasks } = parseTasks(rootTasks);
const globalOptions = parseGlobalOptions(globalOptionDefinitions);
const namePadding = getLongestNameLength([...tasks, ...subtasks, ...globalOptions]) +
GLOBAL_NAME_PADDING;
let output = `Hardhat version ${version}
Usage: hardhat [GLOBAL OPTIONS] <TASK> [SUBTASK] [TASK OPTIONS] [--] [TASK ARGUMENTS]
`;
if (tasks.length > 0) {
output += getSection("AVAILABLE TASKS", tasks, namePadding);
}
if (subtasks.length > 0) {
output += getSection("AVAILABLE SUBTASKS", subtasks, namePadding);
}
output += getSection("GLOBAL OPTIONS", globalOptions, namePadding);
output += `\nTo get help for a specific task run: npx hardhat <TASK> [SUBTASK] --help`;
return output;
}
//# sourceMappingURL=get-global-help-string.js.map