diff --git a/packages/core/__tests__/apiml/__unit__/allPluginCfgPropsMock.json b/packages/core/__tests__/apiml/__unit__/allPluginCfgPropsMock.json index 29f97d35fb..4d7dcb37eb 100644 --- a/packages/core/__tests__/apiml/__unit__/allPluginCfgPropsMock.json +++ b/packages/core/__tests__/apiml/__unit__/allPluginCfgPropsMock.json @@ -6,7 +6,6 @@ "commandModuleGlobs": [ "**/*.definition!(.d).*s" ], - "pluginHealthCheck": "./lib/HealthCheck.handler", "rootCommandDescription": "CA Endevor SCM plug-in for listing Endevor environment information, working with elements and packages located in specified Endevor instance.", "envVariablePrefix": "ENDEVOR", "defaultHome": "C:\\Users\\ej608771/.endevor", @@ -309,7 +308,6 @@ "commandModuleGlobs": [ "**/cli/*/*.definition!(.d).*s" ], - "pluginHealthCheck": "C:\\Users\\ej608771\\.zowe\\plugins\\installed\\node_modules\\@broadcom\\jclcheck-for-zowe-cli\\lib/healthCheck.handler", "pluginSummary": "JCLCheck plugin", "pluginAliases": [ "jck" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index c814fb3df5..cc79c00fb3 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes + +- LTS Breaking: Removed the following previously deprecated items: + - `flattenCommandTreeWithAliases()` -- Use `CommandUtils.flattenCommandTree()` instead + - `AbstractAuthHandler.getPromptParams()` -- Use `getAuthHandlerApi()` instead + - `BaseAuthHandler.getPromptParams()` -- Use `getAuthHandlerApi()` instead + - `promptForInput()` -- Use the asynchronous method `readPrompt()` instead + - `promptWithTimeout()` -- Use `readPrompt` instead which supports more options + - `Imperative.envVariablePrefix` -- Use `ImperativeConfig.instance.envVariablePrefix` instead + - `pluginHealthCheck()` -- Plugins that want to perform a health check can + specify the `pluginLifeCycle` property to load a class from the plugin. + The plugin can implement the `postInstall()` function of that class to perform + a health check, or any other desired operation. + - `IProfOpts.requireKeytar` -- removing the default implementation of `require("keytar")` from the caller app's node_modules folders + ## `8.0.0-next.202311141517` - LTS Breaking: Replaced the previously deprecated function AbstractCommandYargs.getBrightYargsResponse - use AbstractCommandYargs.getZoweYargsResponse diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/suites/ValidatePlugin.ts b/packages/imperative/__tests__/src/packages/imperative/plugins/suites/ValidatePlugin.ts index 2d1a783602..ebabe2e4f9 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/suites/ValidatePlugin.ts +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/suites/ValidatePlugin.ts @@ -247,88 +247,6 @@ describe("Validate plugin", () => { expect(result.status).toEqual(1); }); - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("missing pluginHealthCheck property", () => { - const testPlugin = "missing_pluginHealthCheck"; - const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin); - - let cmd = `plugins install ${fullPluginPath}`; - let result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`); - - cmd = `plugins validate ${testPlugin}`; - result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - result.stderr = removeNewline(result.stderr); - expect(result.stdout).toContain(testPlugin); - expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin."); - expect(result.stdout).not.toContain("Warning"); - expect(result.stdout).not.toContain("The plugin's configuration does not contain an 'imperative.pluginHealthCheck' property."); - expect(result.stderr).not.toContain("Problems detected during plugin validation."); - expect(result.status).toEqual(0); - }); - - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("missing pluginHealthCheck property - warning", () => { - const testPlugin = "missing_pluginHealthCheck"; - const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin); - - let cmd = `plugins install ${fullPluginPath}`; - let result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`); - - cmd = `plugins validate ${testPlugin} --fail-on-warning`; - result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - result.stderr = removeNewline(result.stderr); - expect(result.stdout).toContain(testPlugin); - expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin."); - expect(result.stdout).not.toContain("Warning"); - expect(result.stdout).not.toContain("The plugin's configuration does not contain an 'imperative.pluginHealthCheck' property."); - expect(result.stderr).not.toContain("Problems detected during plugin validation."); - expect(result.status).toEqual(0); - }); - - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("missing pluginHealthCheck handler", () => { - const testPlugin = "missing_healthcheck_handler"; - const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin); - - let cmd = `plugins install ${fullPluginPath}`; - let result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`); - - cmd = `plugins validate ${testPlugin} --no-fail-on-error`; - result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - result.stderr = removeNewline(result.stderr); - expect(result.stdout).toContain(testPlugin); - expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin."); - expect(result.stdout).not.toContain("Error"); - expect(result.stdout).not.toContain(`The program for the 'imperative.pluginHealthCheck' property does not exist:`); - expect(result.stdout).not.toContain("This plugin has configuration errors. No component of the plugin will be available"); - expect(result.stderr).not.toContain("Problems detected during plugin validation."); - expect(result.status).toEqual(0); - }); - - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("missing pluginHealthCheck handler - error", () => { - const testPlugin = "missing_healthcheck_handler"; - const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin); - - let cmd = `plugins install ${fullPluginPath}`; - let result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`); - - cmd = `plugins validate ${testPlugin}`; - result = T.executeTestCLICommand(cliBin, this, cmd.split(" ")); - result.stderr = removeNewline(result.stderr); - expect(result.stdout).toContain(testPlugin); - expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin."); - expect(result.stdout).not.toContain("Error"); - expect(result.stdout).not.toContain(`The program for the 'imperative.pluginHealthCheck' property does not exist:`); - expect(result.stdout).not.toContain("This plugin has configuration errors. No component of the plugin will be available"); - expect(result.stderr).not.toContain("Problems detected during plugin validation."); - expect(result.status).toEqual(0); - }); - it("missing peerDependencies properties", () => { const testPlugin = "missing_dependencies"; const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin); diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/chained_handler_plugin/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/chained_handler_plugin/package.json index 2d9511a451..a4462c7dbf 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/chained_handler_plugin/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/chained_handler_plugin/package.json @@ -10,7 +10,6 @@ "name": "chained-handler-plugin", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "pluginAliases": [ "chp", "chainedhandlerp" diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_bad_chained_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_bad_chained_handler/package.json index dfccfd6f96..a593717a78 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_bad_chained_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_bad_chained_handler/package.json @@ -10,7 +10,6 @@ "name": "definition_bad_chained_handler", "rootCommandDescription": "definition bad chained handler", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_array/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_array/package.json index 94b70a1436..1f93016c2c 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_array/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_array/package.json @@ -10,7 +10,6 @@ "name": "definition_empty_array", "rootCommandDescription": "definition empty array", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [] }, "peerDependencies": { diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_chained_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_chained_handler/package.json index fce6748813..24b3cee220 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_chained_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_empty_chained_handler/package.json @@ -10,7 +10,6 @@ "name": "definition_empty_chained_handler", "rootCommandDescription": "definition empty chained handler", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_chained_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_chained_handler/package.json index ac0e30bbce..3b7c3159a6 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_chained_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_chained_handler/package.json @@ -10,7 +10,6 @@ "name": "definition_missing_chained_handler", "rootCommandDescription": "definition missing chained handler", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_description/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_description/package.json index 7803fc1414..cebf44fa68 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_description/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_description/package.json @@ -10,7 +10,6 @@ "name": "definition_missing_description", "rootCommandDescription": "definition missing description", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_handler/package.json index fd6d54799f..727095a570 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_handler/package.json @@ -10,7 +10,6 @@ "name": "definition_missing_handler", "rootCommandDescription": "definition missing handler", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_name/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_name/package.json index f2497789d1..5723e42824 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_name/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_name/package.json @@ -10,7 +10,6 @@ "name": "definition_missing_name", "rootCommandDescription": "definition missing name", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "description": "dummy foo command", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_type/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_type/package.json index 234197b925..63a75dfdc5 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_type/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_missing_type/package.json @@ -10,7 +10,6 @@ "name": "definition_missing_type", "rootCommandDescription": "definition missing type", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_type_group_without_children/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_type_group_without_children/package.json index 288f7480b5..2ed5d77f7e 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_type_group_without_children/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/definition_type_group_without_children/package.json @@ -10,7 +10,6 @@ "name": "definition_type_group_without_children", "rootCommandDescription": "definition type group without children", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_base_cli_command/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_base_cli_command/package.json index ea2957c5bd..4d67859119 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_base_cli_command/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_base_cli_command/package.json @@ -10,7 +10,6 @@ "name": "plugins", "rootCommandDescription": "duplicated base cli command", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_installed_plugin_command/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_installed_plugin_command/package.json index 71f37ceb63..6d13183e88 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_installed_plugin_command/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/duplicated_installed_plugin_command/package.json @@ -10,7 +10,6 @@ "name": "normal-plugin", "rootCommandDescription": "duplicated installed plugin command", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/incompatible_imperative_version/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/incompatible_imperative_version/package.json index c7bab7c1b5..3dbbd6445d 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/incompatible_imperative_version/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/incompatible_imperative_version/package.json @@ -10,7 +10,6 @@ "name": "incompatible_imperative_version", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^2.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_command_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_command_handler/package.json index 45fa443285..95f46c2ae8 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_command_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_command_handler/package.json @@ -10,7 +10,6 @@ "name": "missing_command_handler", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_definitions/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_definitions/package.json index 6ce9a4fc41..5fde89a050 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_definitions/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_definitions/package.json @@ -9,8 +9,7 @@ "imperative": { "name": "missing_definitions", "rootCommandDescription": "missing definitions", - "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler" + "pluginBaseCliVersion": "^1.0.0" }, "peerDependencies": { "@zowe/imperative": "1.0.0" diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_dependencies/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_dependencies/package.json index f619e6306e..80f9528f1d 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_dependencies/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_dependencies/package.json @@ -10,7 +10,6 @@ "name": "missing_dependencies", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_healthcheck_handler/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_healthcheck_handler/package.json index a9cfb8489c..5c5b588152 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_healthcheck_handler/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_healthcheck_handler/package.json @@ -10,7 +10,6 @@ "name": "missing_healthcheck_handler", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./non_existing_path", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginBaseCliVersion/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginBaseCliVersion/package.json index e0edb6227b..0db2951d39 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginBaseCliVersion/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginBaseCliVersion/package.json @@ -9,7 +9,6 @@ "imperative": { "name": "missing_pluginBaseCliVersion", "rootCommandDescription": "imperative working test plugin", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/dummy.handler.js b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/dummy.handler.js deleted file mode 100644 index fe821d5fd8..0000000000 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/dummy.handler.js +++ /dev/null @@ -1,14 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -/** - * Dummy handler should not be called - */ \ No newline at end of file diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/package.json deleted file mode 100644 index 07c75dba63..0000000000 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_pluginHealthCheck/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "missing_pluginHealthCheck", - "version": "1.0.1", - "description": "Some description", - "main": "../lib/index.js", - "files": [ - "lib" - ], - "imperative": { - "name": "missing_pluginHealthCheck", - "rootCommandDescription": "imperative working test plugin", - "pluginBaseCliVersion": "^1.0.0", - "definitions": [ - { - "name": "foo", - "description": "dummy foo command", - "type": "command", - "handler": "./dummy.handler" - }, - { - "name": "bar", - "description": "dummy bar command", - "type": "command", - "handler": "./dummy.handler" - } - ] - }, - "peerDependencies": { - "@zowe/imperative": "1.0.0" - }, - "typings": "lib/index.d.ts", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "EPL 2.0", - "private": false, - "publishConfig": { - "registry": "http://imperative-npm-registry:4873" - } -} diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_rootCommandDescription/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_rootCommandDescription/package.json index 5dcfae10ca..8b8de2ca07 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_rootCommandDescription/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/missing_rootCommandDescription/package.json @@ -9,7 +9,6 @@ "imperative": { "name": "missing_rootCommandDescription", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_in_plugin/configuration.js b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_in_plugin/configuration.js index ac1ba1c267..44a7331899 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_in_plugin/configuration.js +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_in_plugin/configuration.js @@ -28,7 +28,6 @@ const config = { } } ], - pluginHealthCheck: "./healthCheck.handler", rootCommandDescription: "Test plugin with profiles", pluginBaseCliVersion: "^1.0.0", defaultHome: "../../../../../../__results__/.pluginstest", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_with_cli/configuration.js b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_with_cli/configuration.js index 4cf6d9c949..cdb7189b84 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_with_cli/configuration.js +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/error_plugins/profile_dup_with_cli/configuration.js @@ -27,7 +27,6 @@ const config = { } } ], - pluginHealthCheck: "./healthCheck.handler", rootCommandDescription: "Test plugin with profiles", pluginBaseCliVersion: "^1.0.0", defaultHome: "../../../../../../__results__/.pluginstest", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/missing_name_plugin/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/missing_name_plugin/package.json index 65b16b3f39..5b3a578e38 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/missing_name_plugin/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/missing_name_plugin/package.json @@ -9,7 +9,6 @@ "imperative": { "rootCommandDescription": "missing name plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./dummy.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin/package.json index d7a7584112..1525fe3e5c 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin/package.json @@ -10,7 +10,6 @@ "name": "normal-plugin", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "pluginAliases": [ "np", "normalp" diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_2/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_2/package.json index 26af69aec4..881151fbb2 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_2/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_2/package.json @@ -10,7 +10,6 @@ "name": "normal-plugin-2", "rootCommandDescription": "imperative working test plugin 2", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "definitions": [ { "name": "foo", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_3/lib/sample-plugin/configuration.js b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_3/lib/sample-plugin/configuration.js index f336c1c779..c8d906695c 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_3/lib/sample-plugin/configuration.js +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_3/lib/sample-plugin/configuration.js @@ -26,7 +26,6 @@ const config = { } } ], - pluginHealthCheck: "./lib/sample-plugin/healthCheck.handler", commandModuleGlobs: ["**/cmd/*/*.definition!(.d).*s"], rootCommandDescription: "Test plugin with globs and profiles", pluginBaseCliVersion: "^0.4.0-1", diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_misc/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_misc/package.json index 8cec963ec8..9395b56f88 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_misc/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/normal_plugin_misc/package.json @@ -10,7 +10,6 @@ "name": "normal-plugin-misc", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "pluginAliases": [ "misc" ], diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/override_plugin/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/override_plugin/package.json index e91c6c1b6f..8851951c26 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/override_plugin/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/override_plugin/package.json @@ -10,7 +10,6 @@ "name": "override-plugin", "rootCommandDescription": "imperative override plugin rootCommandDescription", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "overrides": { "CredentialManager": "./sample-plugin/overrides/CredentialManager.override" }, diff --git a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/space in path plugin/package.json b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/space in path plugin/package.json index f731d2cd82..20f717eb7d 100644 --- a/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/space in path plugin/package.json +++ b/packages/imperative/__tests__/src/packages/imperative/plugins/test_plugins/space in path plugin/package.json @@ -10,7 +10,6 @@ "name": "space-in-path-plugin", "rootCommandDescription": "imperative working test plugin", "pluginBaseCliVersion": "^1.0.0", - "pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler", "pluginAliases": [ "np", "normalp" diff --git a/packages/imperative/src/cmd/__tests__/utils/CommandUtils.unit.test.ts b/packages/imperative/src/cmd/__tests__/utils/CommandUtils.unit.test.ts index 37c067546f..c92e854337 100644 --- a/packages/imperative/src/cmd/__tests__/utils/CommandUtils.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/utils/CommandUtils.unit.test.ts @@ -89,7 +89,7 @@ describe("Command Utils", () => { }); it("We should be able to flatten a nested command tree with aliases for display and searching purposes", () => { - const flatten: ICommandTreeEntry[] = CommandUtils.flattenCommandTreeWithAliases(COMPLEX_COMMAND_WITH_ALIASES); + const flatten: ICommandTreeEntry[] = CommandUtils.flattenCommandTree(COMPLEX_COMMAND_WITH_ALIASES); TestLogger.info("Flattened Command Tree:\n" + inspect(flatten)); expect(flatten).toMatchSnapshot(); }); diff --git a/packages/imperative/src/cmd/__tests__/utils/__snapshots__/CommandUtils.unit.test.ts.snap b/packages/imperative/src/cmd/__tests__/utils/__snapshots__/CommandUtils.unit.test.ts.snap index 36b6b6ad5e..303a07dd65 100644 --- a/packages/imperative/src/cmd/__tests__/utils/__snapshots__/CommandUtils.unit.test.ts.snap +++ b/packages/imperative/src/cmd/__tests__/utils/__snapshots__/CommandUtils.unit.test.ts.snap @@ -377,162 +377,6 @@ Array [ "type": "group", }, }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "test-group tc", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, Object { "command": Object { "aliases": Array [ @@ -921,7 +765,7 @@ Array [ ], "type": "command", }, - "fullName": "test-group test-group-2 tc", + "fullName": "test-group test-group-2 test-command-one", "tree": Object { "aliases": Array [ "tg", @@ -1044,164 +888,8 @@ Array [ }, Object { "command": Object { - "aliases": Array [ - "tc", - ], "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "test-group test-group-2 test-command-one", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "description": "my command", - "name": "test-command-two", + "name": "test-command-two", "options": Array [ Object { "aliases": Array [ @@ -1351,2545 +1039,6 @@ Array [ "type": "group", }, }, - Object { - "command": Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - "fullName": "test-group tg2", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "test-group tg2 tc", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "test-group tg2 test-command-one", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "test-group tg2 test-command-two", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - "fullName": "tg", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg tc", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg test-command", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - "fullName": "tg test-group-2", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg test-group-2 tc", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg test-group-2 test-command-one", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg test-group-2 test-command-two", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - "fullName": "tg tg2", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg tg2 tc", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg tg2 test-command-one", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, - Object { - "command": Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - "fullName": "tg tg2 test-command-two", - "tree": Object { - "aliases": Array [ - "tg", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional1", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "aliases": Array [ - "tg2", - ], - "children": Array [ - Object { - "aliases": Array [ - "tc", - ], - "description": "my command", - "name": "test-command-one", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - Object { - "description": "my command", - "name": "test-command-two", - "options": Array [ - Object { - "aliases": Array [ - "to", - ], - "description": "the option", - "name": "test-option", - "type": "string", - }, - Object { - "aliases": Array [ - "tb", - ], - "description": "the boolean option", - "name": "test-boolean", - "type": "boolean", - }, - ], - "positionals": Array [ - Object { - "description": "the positional option", - "name": "positional2", - "required": false, - "type": "string", - }, - ], - "type": "command", - }, - ], - "description": "my group", - "name": "test-group-2", - "type": "group", - }, - ], - "description": "my group", - "name": "test-group", - "type": "group", - }, - }, ] `; diff --git a/packages/imperative/src/cmd/src/utils/CommandUtils.ts b/packages/imperative/src/cmd/src/utils/CommandUtils.ts index 8b3dbf75f2..f535661524 100644 --- a/packages/imperative/src/cmd/src/utils/CommandUtils.ts +++ b/packages/imperative/src/cmd/src/utils/CommandUtils.ts @@ -166,17 +166,6 @@ export class CommandUtils { }); } - /** - * Accepts the command definition document tree and flattens to a single level, including aliases. This is used to make searching - * commands and others easily. - * @param {ICommandDefinition} tree - The command document tree - * @deprecated Use CommandUtils.flattenCommandTree instead - * @return {ICommandTreeEntry[]} - The flattened document tree - */ - public static flattenCommandTreeWithAliases(tree: ICommandDefinition): ICommandTreeEntry[] { - return CommandUtils.flattenCommandTree(tree, true); - } - /** * TODO - This needs to be well tested * TODO - There is a situation where two groups could have the same child command diff --git a/packages/imperative/src/config/__tests__/ProfileCredentials.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileCredentials.unit.test.ts index c0eb7c0ab6..cb8c450dae 100644 --- a/packages/imperative/src/config/__tests__/ProfileCredentials.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileCredentials.unit.test.ts @@ -183,104 +183,6 @@ describe("ProfileCredentials tests", () => { expect(mockCredMgrInitialize).toHaveBeenCalledTimes(1); }); - it("should load Keytar using custom require method", async () => { - const requireKeytar = jest.fn(() => "fakeModule"); - const profCreds = new ProfileCredentials({ - usingTeamConfig: false - } as any, { - credMgrOverride: ProfileCredentials.defaultCredMgrWithKeytar(requireKeytar as any) - }); - jest.spyOn(profCreds, "isSecured", "get").mockReturnValue(true); - jest.spyOn(CredentialManagerFactory, "initialize").mockImplementation(async (params: ICredentialManagerInit) => { - await new (params.Manager as typeof DefaultCredentialManager)(params.service, params.displayName).initialize(); - }); - let caughtError; - - try { - await profCreds.loadManager(); - } catch (error) { - caughtError = error; - } - - expect(caughtError).toBeUndefined(); - expect(CredentialManagerFactory.initialize).toHaveBeenCalledTimes(1); - expect(requireKeytar).toHaveBeenCalledTimes(1); - }); - - it("should fail to load Keytar if custom require method throws", async () => { - const requireKeytar = jest.fn(() => { - throw new Error("keytar not found"); - }); - const profCreds = new ProfileCredentials({ - usingTeamConfig: false - } as any, { - credMgrOverride: ProfileCredentials.defaultCredMgrWithKeytar(requireKeytar as any) - }); - jest.spyOn(profCreds, "isSecured", "get").mockReturnValue(true); - jest.spyOn(CredentialManagerFactory, "initialize").mockImplementation(async (params: ICredentialManagerInit) => { - await new (params.Manager as typeof DefaultCredentialManager)(params.service, params.displayName).initialize(); - }); - let caughtError; - - try { - await profCreds.loadManager(); - } catch (error) { - caughtError = error; - } - - expect(caughtError).toBeDefined(); - expect(caughtError.message).toMatch(/^Failed to load Keytar module:/); - expect(CredentialManagerFactory.initialize).toHaveBeenCalledTimes(1); - expect(requireKeytar).toHaveBeenCalledTimes(1); - }); - - it("should load Keytar using custom require method - deprecated", async () => { - const requireKeytar = jest.fn(() => "fakeModule"); - const profCreds = new ProfileCredentials({ - usingTeamConfig: false - } as any, requireKeytar as any); - jest.spyOn(profCreds, "isSecured", "get").mockReturnValue(true); - jest.spyOn(CredentialManagerFactory, "initialize").mockImplementation(async (params: ICredentialManagerInit) => { - await new (params.Manager as any)(null).initialize(); - }); - let caughtError; - - try { - await profCreds.loadManager(); - } catch (error) { - caughtError = error; - } - - expect(caughtError).toBeUndefined(); - expect(CredentialManagerFactory.initialize).toHaveBeenCalledTimes(1); - expect(requireKeytar).toHaveBeenCalledTimes(1); - }); - - it("should fail to load Keytar if custom require method throws - deprecated", async () => { - const requireKeytar = jest.fn(() => { - throw new Error("keytar not found"); - }); - const profCreds = new ProfileCredentials({ - usingTeamConfig: false - } as any, requireKeytar as any); - jest.spyOn(profCreds, "isSecured", "get").mockReturnValue(true); - jest.spyOn(CredentialManagerFactory, "initialize").mockImplementation(async (params: ICredentialManagerInit) => { - await new (params.Manager as any)(null).initialize(); - }); - let caughtError; - - try { - await profCreds.loadManager(); - } catch (error) { - caughtError = error; - } - - expect(caughtError).toBeDefined(); - expect(caughtError.message).toMatch(/^Failed to load Keytar module:/); - expect(CredentialManagerFactory.initialize).toHaveBeenCalledTimes(1); - expect(requireKeytar).toHaveBeenCalledTimes(1); - }); - it("should call Config secure load API when team config enabled", async () => { const mockSecureLoad = jest.fn(); const profCreds = new ProfileCredentials({ diff --git a/packages/imperative/src/config/src/ProfileInfo.ts b/packages/imperative/src/config/src/ProfileInfo.ts index 6d15c63a3e..65d6dadc92 100644 --- a/packages/imperative/src/config/src/ProfileInfo.ts +++ b/packages/imperative/src/config/src/ProfileInfo.ts @@ -179,7 +179,7 @@ export class ProfileInfo { this.mOverrideWithEnv = profInfoOpts.overrideWithEnv; } - this.mCredentials = new ProfileCredentials(this, profInfoOpts?.requireKeytar ?? profInfoOpts); + this.mCredentials = new ProfileCredentials(this, profInfoOpts); // do enough Imperative stuff to let imperative utilities work this.initImpUtils(); diff --git a/packages/imperative/src/config/src/doc/IProfOpts.ts b/packages/imperative/src/config/src/doc/IProfOpts.ts index 8bc78f16cd..ca5b5f14bb 100644 --- a/packages/imperative/src/config/src/doc/IProfOpts.ts +++ b/packages/imperative/src/config/src/doc/IProfOpts.ts @@ -28,14 +28,6 @@ export interface IProfOpts { */ overrideWithEnv?: boolean; - /** - * Implements a custom method to require Keytar module which manages - * secure credentials. If undefined, the default implementation is to - * `require("keytar")` from the caller app's node_modules folder. - * @deprecated - */ - requireKeytar?: () => NodeModule; - /** * Overrides the credential manager class used to load and store secure * properties. If undefined, the default implementation is to use the diff --git a/packages/imperative/src/imperative/__tests__/Imperative.unit.test.ts b/packages/imperative/src/imperative/__tests__/Imperative.unit.test.ts index a35f520902..9b5ff1cc51 100644 --- a/packages/imperative/src/imperative/__tests__/Imperative.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/Imperative.unit.test.ts @@ -356,11 +356,11 @@ describe("Imperative", () => { beforeEach(() => { loggingConfig = mocks.LoggingConfigurer.configureLogger("dont care", {}); - envConfig = mocks.EnvironmentalVariableSettings.read(Imperative.envVariablePrefix); + envConfig = mocks.EnvironmentalVariableSettings.read(mocks.ImperativeConfig.instance.envVariablePrefix); }); it("should know what the envVariablePrefix is [DEPRECATED]", async () => { - expect(Imperative.envVariablePrefix).toEqual(defaultConfig.name); + expect(mocks.ImperativeConfig.instance.envVariablePrefix).toEqual(defaultConfig.name); }); it("should handle a valid imperative log level", async () => { diff --git a/packages/imperative/src/imperative/__tests__/config/cmd/init/init.handler.unit.test.ts b/packages/imperative/src/imperative/__tests__/config/cmd/init/init.handler.unit.test.ts index df45527c1c..05ae7e4e72 100644 --- a/packages/imperative/src/imperative/__tests__/config/cmd/init/init.handler.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/config/cmd/init/init.handler.unit.test.ts @@ -135,8 +135,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -150,9 +150,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(user ? 0 : 1); // User config is a skeleton - no prompting should occur + expect(readPromptSpy).toHaveBeenCalledTimes(user ? 0 : 1); // User config is a skeleton - no prompting should occur // Prompting for secure property - if (!user) expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + if (!user) expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(editFileSpy).not.toHaveBeenCalled(); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); @@ -183,8 +183,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files // initForDryRun @@ -195,7 +195,7 @@ describe("Configuration Initialization command handler", () => { expect(ensureCredMgrSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(0); // Dry run mode - no prompting should occur + expect(readPromptSpy).toHaveBeenCalledTimes(0); // Dry run mode - no prompting should occur expect(initForDryRunSpy).toHaveBeenCalledTimes(1); expect(initForDryRunSpy).toHaveBeenCalledWith(ImperativeConfig.instance.config, params.arguments.userConfig); @@ -224,8 +224,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -239,9 +239,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(user ? 0 : 1); + expect(readPromptSpy).toHaveBeenCalledTimes(user ? 0 : 1); // Prompting for secure property - if (!user) expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + if (!user) expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); @@ -272,8 +272,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -285,7 +285,7 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(0); // CI flag should not prompt + expect(readPromptSpy).toHaveBeenCalledTimes(0); // CI flag should not prompt expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -314,8 +314,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -327,7 +327,7 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(0); // CI flag should not prompt + expect(readPromptSpy).toHaveBeenCalledTimes(0); // CI flag should not prompt expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); @@ -353,8 +353,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -399,8 +399,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "fakeValue"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "fakeValue"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files if (!global) jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -408,7 +408,7 @@ describe("Configuration Initialization command handler", () => { expect(ensureCredMgrSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(user ? 0 : 1); + expect(readPromptSpy).toHaveBeenCalledTimes(user ? 0 : 1); expect(editFileSpy).toHaveBeenCalledWith(ImperativeConfig.instance.config.layerActive().path); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); @@ -433,8 +433,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "true"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "true"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -447,9 +447,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -477,8 +477,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "false"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "false"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -491,9 +491,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -523,8 +523,8 @@ describe("Configuration Initialization command handler", () => { // initWithSchema const randomValueString = "9001"; const randomValueNumber = parseInt(randomValueString, 10); - const promptWithTimeoutSpy = jest.fn(() => randomValueString); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => randomValueString); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -537,9 +537,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -567,8 +567,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => undefined); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => undefined); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -581,9 +581,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -621,8 +621,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "area51"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "area51"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -635,9 +635,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -675,8 +675,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => "area51"); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => "area51"); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -689,9 +689,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -731,8 +731,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => ""); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => ""); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(process, "cwd").mockReturnValueOnce(null); @@ -745,9 +745,9 @@ describe("Configuration Initialization command handler", () => { expect(setSchemaSpy).toHaveBeenCalledTimes(1); expect(setSchemaSpy).toHaveBeenCalledWith(expectedSchemaObject); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(2); + expect(readPromptSpy).toHaveBeenCalledTimes(2); // Prompting for secure property - expect(promptWithTimeoutSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); + expect(readPromptSpy).toHaveBeenCalledWith(expect.stringContaining("to skip:"), {"hideText": true}); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); // 1 = Schema and 2 = Config @@ -776,8 +776,8 @@ describe("Configuration Initialization command handler", () => { searchSpy.mockClear(); // initWithSchema - const promptWithTimeoutSpy = jest.fn(() => undefined); - (params.response.console as any).prompt = promptWithTimeoutSpy; + const readPromptSpy = jest.fn(() => undefined); + (params.response.console as any).prompt = readPromptSpy; writeFileSyncSpy.mockImplementation(); // Don't actually write files jest.spyOn(CredentialManagerFactory, "initialized", "get").mockReturnValue(false); jest.spyOn(CredentialManagerFactory, "manager", "get").mockReturnValue({ secureErrorDetails: jest.fn() } as any); @@ -789,7 +789,7 @@ describe("Configuration Initialization command handler", () => { lodash.merge(compObj, ImperativeConfig.instance.config.properties); // Add the properties from the config delete compObj.profiles.base.properties.secret; // Delete the secret - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(0); + expect(readPromptSpy).toHaveBeenCalledTimes(0); expect(writeFileSyncSpy).toHaveBeenCalledTimes(2); expect(params.response.console.log).toHaveBeenCalledTimes(2); expect((params.response.console.log as any).mock.calls[0][0]).toContain("Unable to securely save credentials"); diff --git a/packages/imperative/src/imperative/__tests__/config/cmd/secure/secure.handler.unit.test.ts b/packages/imperative/src/imperative/__tests__/config/cmd/secure/secure.handler.unit.test.ts index d3adb82832..eaf068137e 100644 --- a/packages/imperative/src/imperative/__tests__/config/cmd/secure/secure.handler.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/config/cmd/secure/secure.handler.unit.test.ts @@ -27,6 +27,7 @@ import * as fs from "fs"; import { SessConstants } from "../../../../../rest"; import { setupConfigToLoad } from "../../../../../../__tests__/src/TestUtil"; +let readPromptSpy: any; const getIHandlerParametersObject = (): IHandlerParameters => { const x: any = { response: { @@ -45,7 +46,8 @@ const getIHandlerParametersObject = (): IHandlerParameters => { error: jest.fn((errors) => { // Nothing }), - errorHeader: jest.fn(() => undefined) + errorHeader: jest.fn(() => undefined), + prompt: readPromptSpy } }, arguments: {}, @@ -86,6 +88,7 @@ describe("Configuration Secure command handler", () => { let keytarSetPasswordSpy: any; let keytarDeletePasswordSpy: any; + readPromptSpy = jest.fn().mockReturnValue("fakePromptingData"); const configOpts: IConfigOpts = { vault: { load: ((k: string): Promise => { @@ -118,6 +121,7 @@ describe("Configuration Secure command handler", () => { keytarGetPasswordSpy = jest.spyOn(keytar, "getPassword"); keytarSetPasswordSpy = jest.spyOn(keytar, "setPassword"); keytarDeletePasswordSpy = jest.spyOn(keytar, "deletePassword"); + readPromptSpy.mockClear(); }); afterEach( () => { @@ -156,9 +160,8 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy: any = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); + (params.response.console as any).prompt = jest.fn(() => "fakePromptingData"); await handler.process(params); @@ -182,7 +185,6 @@ describe("Configuration Secure command handler", () => { } expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); expect(writeFileSyncSpy).toHaveBeenNthCalledWith(1, fakeProjPath, JSON.stringify(compObj, null, 4)); // Config @@ -220,8 +222,6 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); await handler.process(params); @@ -245,7 +245,6 @@ describe("Configuration Secure command handler", () => { } expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); expect(writeFileSyncSpy).toHaveBeenNthCalledWith(1, fakeProjUserPath, JSON.stringify(compObj, null, 4)); // Config @@ -284,8 +283,6 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); await handler.process(params); @@ -310,7 +307,6 @@ describe("Configuration Secure command handler", () => { } expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); expect(writeFileSyncSpy).toHaveBeenNthCalledWith(1, fakeGblProjPath, JSON.stringify(compObj, null, 4)); // Config @@ -349,9 +345,6 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy: any = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; - setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); await handler.process(params); @@ -376,7 +369,6 @@ describe("Configuration Secure command handler", () => { } expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); expect(writeFileSyncSpy).toHaveBeenNthCalledWith(1, fakeGblProjUserPath, JSON.stringify(compObj, null, 4)); // Config @@ -415,8 +407,6 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); await handler.process(params); @@ -424,7 +414,6 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(0); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(0); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(0); expect(writeFileSyncSpy).toHaveBeenCalledTimes(0); expect(ImperativeConfig.instance.config.api.secure.secureFields().length).toEqual(0); }); @@ -462,8 +451,6 @@ describe("Configuration Secure command handler", () => { existsSyncSpy.mockClear(); readFileSyncSpy.mockClear(); - const promptWithTimeoutSpy = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; setSchemaSpy = jest.spyOn(ImperativeConfig.instance.config, "setSchema"); await handler.process(params); @@ -488,7 +475,6 @@ describe("Configuration Secure command handler", () => { } expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(2); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); expect(writeFileSyncSpy).toHaveBeenNthCalledWith(1, fakeProjPath, JSON.stringify(compObj, null, 4)); // Config @@ -521,7 +507,6 @@ describe("Configuration Secure command handler", () => { const handler = new SecureHandler(); const params = getIHandlerParametersObject(); let mockAuthHandlerApi: any; - let promptWithTimeoutSpy: any; beforeAll(() => { mockAuthHandlerApi = { @@ -558,8 +543,6 @@ describe("Configuration Secure command handler", () => { mockAuthHandlerApi.sessionLogin.mockClear(); writeFileSyncSpy.mockReset(); - promptWithTimeoutSpy = jest.fn(() => "fakePromptingData"); - (params.response.console as any).prompt = promptWithTimeoutSpy; }); afterAll(() => { @@ -610,7 +593,6 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(process.platform === "win32" ? 4 : 3); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(4); // User and password expect(mockAuthHandlerApi.createSessCfg).toHaveBeenCalledTimes(2); expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(2); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); @@ -646,7 +628,6 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(process.platform === "win32" ? 4 : 3); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(0); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); @@ -681,7 +662,7 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(process.platform === "win32" ? 4 : 3); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(0); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); @@ -723,7 +704,7 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(process.platform === "win32" ? 4 : 3); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(0); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); @@ -767,7 +748,7 @@ describe("Configuration Secure command handler", () => { expect(keytarDeletePasswordSpy).toHaveBeenCalledTimes(process.platform === "win32" ? 4 : 3); expect(keytarGetPasswordSpy).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(1); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(1); + expect(readPromptSpy).toHaveBeenCalledTimes(1); expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(0); expect(keytarSetPasswordSpy).toHaveBeenCalledWith("Zowe", "secure_config_props", fakeSecureDataExpected); expect(writeFileSyncSpy).toHaveBeenCalledTimes(1); @@ -801,7 +782,7 @@ describe("Configuration Secure command handler", () => { expect(caughtError).toBeDefined(); expect(caughtError.message).toContain("Failed to fetch jwtToken"); - expect(promptWithTimeoutSpy).toHaveBeenCalledTimes(2); // User and password + expect(readPromptSpy).toHaveBeenCalledTimes(2); // User and password expect(mockAuthHandlerApi.sessionLogin).toHaveBeenCalledTimes(1); expect(keytarSetPasswordSpy).toHaveBeenCalledTimes(0); expect(writeFileSyncSpy).toHaveBeenCalledTimes(0); diff --git a/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts b/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts index ea9ef295ef..45cfb9f1b1 100644 --- a/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts @@ -87,7 +87,6 @@ describe("Plugin Management Facility", () => { pluginAliases: goodPluginAliases, pluginSummary: goodPluginSummary, rootCommandDescription: "imperative sample plugin", - pluginHealthCheck: "./lib/sample-plugin/healthCheck.handler", // TODO: remove in V3, when pluginHealthCheck is removed definitions: [ { name: "foo", @@ -734,46 +733,6 @@ describe("Plugin Management Facility", () => { "The plugin defines no commands and overrides no framework components."); }); - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("should not record warning if pluginHealthCheck property does not exist", () => { - // remove pluginHealthCheck property from config - badPluginConfig = JSON.parse(JSON.stringify(basePluginConfig)); - delete badPluginConfig.pluginHealthCheck; - badPluginCfgProps = JSON.parse(JSON.stringify(basePluginCfgProps)); - badPluginCfgProps.impConfig = badPluginConfig; - - // Ensure we get to the function that we want to validate - mockConflictNmOrAlias.mockReturnValueOnce({ hasConflict: false }); - mockAreVersionsCompatible.mockReturnValueOnce(true); - - isValid = PMF.validatePlugin(badPluginCfgProps, basePluginCmdDef); - - // missing healthCheck is just a warning, so we succeed - expect(isValid).toBe(true); - - // we no longer report any error about missing pluginHealthCheck property - expect(pluginIssues.getIssueListForPlugin(pluginName).length).toBe(0); - }); - - // TODO: remove this test in V3, when pluginHealthCheck is removed - it("should not record error if pluginHealthCheck file does not exist", () => { - // set pluginHealthCheck property to a bogus file - badPluginConfig = JSON.parse(JSON.stringify(basePluginConfig)); - badPluginConfig.pluginHealthCheck = "./This/File/Does/Not/Exist"; - badPluginCfgProps = JSON.parse(JSON.stringify(basePluginCfgProps)); - badPluginCfgProps.impConfig = badPluginConfig; - - // Ensure we get to the function that we want to validate - mockConflictNmOrAlias.mockReturnValueOnce({ hasConflict: false }); - mockAreVersionsCompatible.mockReturnValueOnce(true); - - isValid = PMF.validatePlugin(badPluginCfgProps, basePluginCmdDef); - expect(isValid).toBe(true); - - // we no longer report any error about missing pluginHealthCheck file - expect(pluginIssues.getIssueListForPlugin(pluginName).length).toBe(0); - }); - it("should record error when ConfigurationValidator throws an exception", () => { // Ensure we get to the function that we want to validate PMF.conflictingNameOrAlias = realConflictName; diff --git a/packages/imperative/src/imperative/src/Imperative.ts b/packages/imperative/src/imperative/src/Imperative.ts index 8f6c53e201..2e83949c47 100644 --- a/packages/imperative/src/imperative/src/Imperative.ts +++ b/packages/imperative/src/imperative/src/Imperative.ts @@ -419,15 +419,6 @@ export class Imperative { return TextUtils.chalk[ImperativeConfig.instance.loadedConfig.primaryTextColor](text); } - /** - * Get the configured environmental variable prefix for the user's CLI - * @returns {string} - the configured or default prefix for environmental variables for use in the environmental variable service - * @deprecated Please use ImperativeConfig.instance.envVariablePrefix - */ - public static get envVariablePrefix(): string { - return ImperativeConfig.instance.envVariablePrefix; - } - /** * Highlight text with your configured (or default) secondary color * @param {string} text - the text to highlight diff --git a/packages/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts b/packages/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts index 107ebf2bda..5aceeff341 100644 --- a/packages/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts +++ b/packages/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts @@ -11,7 +11,7 @@ import { ICommandHandler, IHandlerParameters, ICommandArguments } from "../../../../cmd"; import { Constants } from "../../../../constants"; -import { AbstractSession, IOptionsForAddConnProps, ISession, SessConstants } from "../../../../rest"; +import { ISession, SessConstants } from "../../../../rest"; import { ImperativeError } from "../../../../error"; import { IAuthHandlerApi } from "../doc/IAuthHandlerApi"; @@ -60,16 +60,6 @@ export abstract class AbstractAuthHandler implements ICommandHandler { } } - /** - * This is called by the "config secure" handler when it needs to prompt - * for connection info to obtain an auth token. - * @deprecated Use `getAuthHandlerApi` instead - * @returns A tuple containing: - * - Options for adding connection properties - * - The login handler - */ - public abstract getPromptParams(): [IOptionsForAddConnProps, (session: AbstractSession) => Promise]; - /** * Returns auth handler API that provides convenient functions to create a * session from args, and use it to login or logout of an auth service. diff --git a/packages/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts b/packages/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts index 95938b3f60..6a99f418bb 100644 --- a/packages/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts +++ b/packages/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts @@ -13,7 +13,6 @@ import { IHandlerParameters, IHandlerResponseApi } from "../../../../cmd"; import { AbstractSession, ConnectionPropsForSessCfg, - IOptionsForAddConnProps, ISession, RestConstants, SessConstants, @@ -53,21 +52,6 @@ export abstract class BaseAuthHandler extends AbstractAuthHandler { */ protected abstract doLogout(session: AbstractSession): Promise; - /** - * This is called by the "config secure" handler when it needs to prompt - * for connection info to obtain an auth token. - * @deprecated Use `getAuthHandlerApi` instead - * @returns A tuple containing: - * - Options for adding connection properties - * - The login handler - */ - public getPromptParams(): [IOptionsForAddConnProps, (session: AbstractSession) => Promise] { - return [{ - defaultTokenType: this.mDefaultTokenType, - serviceDescription: this.mServiceDescription - }, this.doLogin]; - } - /** * Returns auth handler API that provides convenient functions to create a * session from args, and use it to login or logout of an auth service. diff --git a/packages/imperative/src/imperative/src/doc/IImperativeConfig.ts b/packages/imperative/src/imperative/src/doc/IImperativeConfig.ts index 2142fe3c5a..473941bae8 100644 --- a/packages/imperative/src/imperative/src/doc/IImperativeConfig.ts +++ b/packages/imperative/src/imperative/src/doc/IImperativeConfig.ts @@ -233,31 +233,6 @@ export interface IImperativeConfig { */ pluginLifeCycle?: string; - /** - * A path to a module (javascript file) that will perform a health check for a plugin. - * The health check should verify the health of the plugin. - * The implementor of a plugin determines what actions - * can confirm that the plugin is in an operational state. - * - * The health check should return true if all plugin health checks pass. - * It should return false otherwise. - * - * This property is unused for a base CLI. - * - * No Zowe CLI command currently calls the health check function. - * - * @deprecated - * This property is deprecated. Plugins that want to perform a health check can - * specify the pluginLifeCycle property to load a class from the plugin. - * The plugin can implement the postInstall() function of that class to perform - * a health check, or any other desired operation. Our intention is to remove - * the pluginHealthCheck property in Zowe V3. - * - * @type {string} - * @memberof IImperativeConfig - */ - pluginHealthCheck?: string; - /** * If the project you are configuring is an Imperative plugin, * you can assign aliases to the group that is added when a user diff --git a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts index f7c5ff9675..2d498bbba2 100644 --- a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts +++ b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts @@ -224,7 +224,6 @@ export class PluginManagementFacility { */ public loadAllPluginCfgProps(): void { // Initialize the plugin.json file if needed - // TODO Skip creation of PMF_ROOT directory once it is deprecated by team config if (!existsSync(this.pmfConst.PLUGIN_JSON)) { if (!existsSync(this.pmfConst.PMF_ROOT)) { this.impLogger.debug("Creating PMF_ROOT directory"); diff --git a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts index c0b2b6ae22..acfcfd2dda 100644 --- a/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/CliUtils.unit.test.ts @@ -14,7 +14,6 @@ import { CliUtils } from "../src/CliUtils"; import { CommandProfiles, ICommandOptionDefinition } from "../../cmd"; import { IProfile } from "../../profiles"; import { ImperativeError } from "../../error"; -import * as prompt from "readline-sync"; jest.mock("readline-sync"); @@ -125,17 +124,6 @@ describe("CliUtils", () => { }); }); - describe("promptForInput", () => { - it("should return the mocked value", () => { - const mockedPromptValue = "My value is here "; - (prompt as any).question = jest.fn(() => { - return mockedPromptValue; - }); - const value = CliUtils.promptForInput("my message goes here:"); - expect(value).toEqual(mockedPromptValue); - }); - }); - describe("sleep", () => { it("should sleep for 1 second", async () => { const startTime = Date.now(); @@ -147,74 +135,6 @@ describe("CliUtils", () => { }); }); - describe("promptWithTimeout", () => { - let readline = require("readline"); - let readlineReal: any; - const mockedAnswer = "User answer"; - - beforeEach(() => { - readlineReal = readline; - readline.createInterface = jest.fn(() => { - return { - prompt: jest.fn(() => { - // do nothing - }), - on: jest.fn((eventName: string, callback: any) => { - if (eventName === "line") { - callback(mockedAnswer); - } - return { - on: jest.fn((chainedEvtNm: string, chainedCallBack: any) => { - if (chainedEvtNm === "close") { - chainedCallBack(); - } - }), - }; - }), - output: { - write: jest.fn(() => { - // do nothing - }) - }, - close: jest.fn(() => { - // do nothing - }) - }; - }); - }); - - afterEach(() => { - readline = readlineReal; - }); - - it("should return the user's answer", async () => { - const answer = await CliUtils.promptWithTimeout("Question to be asked: "); - expect(answer).toEqual(mockedAnswer); - }); - - it("should accept a hideText parameter", async () => { - const answer = await CliUtils.promptWithTimeout("Should we hide your answer: ", true); - expect(answer).toEqual(mockedAnswer); - }); - - it("should accept a secToWait parameter", async () => { - const secToWait = 15; - const answer = await CliUtils.promptWithTimeout("Should wait your amount of time: ", - false, secToWait - ); - expect(answer).toEqual(mockedAnswer); - }); - - it("should limit to a max secToWait", async () => { - const tooLong = 1000; - const answer = await CliUtils.promptWithTimeout("Should wait your amount of time: ", - false, tooLong - ); - expect(answer).toEqual(mockedAnswer); - }); - - }); - describe("readPrompt", () => { const readline = require("readline"); const oldCreateInterface = readline.createInterface; @@ -243,14 +163,15 @@ describe("CliUtils", () => { it("should accept a secToWait parameter", async () => { const secToWait = 15; const answer = await CliUtils.readPrompt("Should wait your amount of time: ", - { hideText: false, secToWait } + { hideText: false, secToWait: secToWait } ); expect(answer).toEqual(mockedAnswer); }); it("should limit to a max secToWait", async () => { const tooLong = 1000; - const answer = await CliUtils.readPrompt("Should wait your amount of time: ", + const answer = await CliUtils.readPrompt( + "Should wait your amount of time: ", { hideText: false, secToWait: tooLong } ); expect(answer).toEqual(mockedAnswer); diff --git a/packages/imperative/src/utilities/src/CliUtils.ts b/packages/imperative/src/utilities/src/CliUtils.ts index 70820af93d..34720325bb 100644 --- a/packages/imperative/src/utilities/src/CliUtils.ts +++ b/packages/imperative/src/utilities/src/CliUtils.ts @@ -19,8 +19,6 @@ import { CommandProfiles, ICommandOptionDefinition, ICommandPositionalDefinition } from "../../cmd"; import { ICommandArguments } from "../../cmd/src/doc/args/ICommandArguments"; import { IProfile } from "../../profiles"; -import * as prompt from "readline-sync"; -import * as os from "os"; import { IPromptOptions } from "../../cmd/src/doc/response/api/handler/IPromptOptions"; /** @@ -437,20 +435,6 @@ export class CliUtils { return args; } - /** - * Display a prompt that hides user input and reads from stdin - * DOES NOT WORK WITH COMMANDS THAT ALSO READ STDIN - * Useful for prompting the user for sensitive info such as passwords - * Synchronous - * @deprecated Use the asynchronous method `readPrompt` instead - * @param message - The message to display to the user e.g. "Please enter password:" - * @returns value - the value entered by the user - */ - public static promptForInput(message: string): string { - prompt.setDefaultOptions({mask: "", hideEchoBack: true}); - return prompt.question(message); - } - /** * Sleep for the specified number of miliseconds. * @param timeInMs Number of miliseconds to sleep @@ -465,98 +449,6 @@ export class CliUtils { }); } - /** - * Prompt the user with a question and wait for an answer, - * but only up to the specified timeout. - * - * @deprecated Use `readPrompt` instead which supports more options - * @param questionText The text with which we will prompt the user. - * - * @param hideText Should we hide the text. True = display stars. - * False = display text. Default = false. - * - * @param secToWait The number of seconds that we will wait for an answer. - * If not supplied, the default is 600 seconds. - * - * @return A string containing the user's answer, or null if we timeout. - * - * @example - * const answer = await CliUtils.promptWithTimeout("Type your answer here: "); - * if (answer === null) { - * // abort the operation that you wanted to perform - * } else { - * // use answer in some operation - * } - */ - public static async promptWithTimeout( - questionText: string, - hideText: boolean = false, - secToWait: number = 600, - ): Promise { - - // readline provides our interface for terminal I/O - const readline = require("readline"); - const ttyIo = readline.createInterface({ - input: process.stdin, - output: process.stdout, - terminal: true, - prompt: questionText - }); - const writeToOutputOrig = ttyIo._writeToOutput; - - // ask user the desired question and then asynchronously read answer - ttyIo.prompt(); - let answerToReturn: string = null; - ttyIo.on("line", (answer: string) => { - answerToReturn = answer; - ttyIo.close(); - }).on("close", () => { - if (hideText) { - // The user's Enter key was echoed as a '*', so now output a newline - ttyIo._writeToOutput = writeToOutputOrig; - ttyIo.output.write("\n"); - } - }); - - // when asked to hide text, override output to only display stars - if (hideText) { - ttyIo._writeToOutput = function _writeToOutput(stringToWrite: string) { - if (stringToWrite === os.EOL) { - return; - } - if (stringToWrite.length === 1) { - // display a star for each one character of the hidden response - ttyIo.output.write("*"); - } else { - /* After a backspace, we get a string with the whole question - * and the hidden response. Redisplay the prompt and hide the response. - */ - let stringToShow = stringToWrite.substring(0, questionText.length); - for (let count = 1; count <= stringToWrite.length - questionText.length; count ++) { - stringToShow += "*"; - } - ttyIo.output.write(stringToShow); - } - }; - } - - // Ensure that we use a reasonable timeout - const maxSecToWait = 900; // 15 minute max - if (secToWait > maxSecToWait || secToWait <= 0) { - secToWait = maxSecToWait; - } - - // loop until timeout, to give our earlier asynch read a chance to work - const oneSecOfMillis = 1000; - for (let count = 1; answerToReturn === null && count <= secToWait; count++) { - await CliUtils.sleep(oneSecOfMillis); - } - - // terminate our use of the ttyIo object - ttyIo.close(); - return answerToReturn; - } - /** * Prompt the user with a question and wait for an answer, * but only up to the specified timeout.