How to use the @zowe/imperative.Imperative.fullCommandTree function in @zowe/imperative

To help you get started, we’ve selected a few @zowe/imperative examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / zowe-cli-cics-deploy-plugin / gulp / GenerateDoc.ts View on Github external
const doc: ITaskFunction = async () => {
    process.env.FORCE_COLOR = "0";

    // Get all command definitions
    const myConfig = ImperativeConfig.instance;
    // myConfig.callerLocation = __dirname;
    myConfig.loadedConfig = require("../src/imperative");

    myConfig.loadedConfig.commandModuleGlobs = ["src/cli/*/*.definition!(.d).*s"];


    // Need to set this for the internal caller location so that the commandModuleGlobs finds the commands
    process.mainModule.filename = __dirname + "/../package.json";

    await Imperative.init(myConfig.loadedConfig);
    const loadedDefinitions = Imperative.fullCommandTree;
    clearRequire.all(); // in case the code has changed, reload any code

    let totalCommands = 0;
    let markdownContent = "# Zowe CLI cics-deploy plugin command reference\n\n";

    markdownContent += "{{tableOfContents}}\n\n";
    let tableOfContentsText = "### Table of Contents\n";

    const tabIndent = "\t";
    let oldCommandName = "";

    function getGroupHelp(definition: any, indentLevel: number = 0) {
        let commandNameSummary = definition.name;
        if (definition.aliases.length > 0 &&
            !(definition.aliases[0].trim().length === 0 && definition.aliases.length === 1)) {
            commandNameSummary += " | " + definition.aliases.join(" | ");