Skip to content

Commit

Permalink
Merge pull request #2361 from zowe/help-web
Browse files Browse the repository at this point in the history
Enhanced #2301 to include "--help-web" commands to pass even if presence of a faulty configuration
  • Loading branch information
ATorrise authored Nov 13, 2024
2 parents a9d082f + 17991e3 commit 53cc0d0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/imperative/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Imperative package will be documented in this file.

## Recent Changes

- Enhancement: Enhanced [#2301](https://github.com/zowe/zowe-cli/pull/2301) to include "--help-web" commands to pass even if presence of a faulty configuration.

## `8.8.1`

- BugFix: Fixed an issue where the `ProfileInfo.profileManagerWillLoad` method failed if profiles were not yet read from disk. [#2284](https://github.com/zowe/zowe-cli/issues/2284)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ describe("Hello World", () => {
expect(response.stdout.toString()).toContain("help");
expect(response.stderr.toString()).toContain("Please check this configuration file for errors.");
});

it ("should trigger help-web even if bad config", async () => {
const response = await TestUtils.runCliScript(__dirname + "/scripts/help.sh", TEST_ENVIRONMENT.workingDir);
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("help-web");
expect(response.stderr.toString()).toContain("Please check this configuration file for errors.");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
hello-world-cli --help-web
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe("Command Processor", () => {
jest.restoreAllMocks();
});

it("should fail command execution without --help or --version if config is faulty", async () => {
it("should fail command execution without --help, --help-web or --version if config is faulty", async () => {
const parms: any = { arguments: { _: ["some", "command"], $0: "" }, silent: true };
const response: ICommandResponse = await faultyConfigProcessor.invoke(parms);

Expand Down
2 changes: 2 additions & 0 deletions packages/imperative/src/imperative/src/Imperative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export class Imperative {
// Detect CLI arguments to determine if errors should be ignored
const ignoreErrors = process.argv.includes(Constants.OPT_LONG_DASH + Constants.HELP_OPTION) ||
process.argv.includes(Constants.OPT_SHORT_DASH + Constants.HELP_OPTION_ALIAS) ||
process.argv.includes(Constants.OPT_LONG_DASH + Constants.HELP_WEB_OPTION) ||
process.argv.includes(Constants.OPT_SHORT_DASH + Constants.HELP_WEB_OPTION_ALIAS) ||
process.argv.includes(Constants.OPT_LONG_DASH + Constants.VERSION_OPTION) ||
process.argv.includes(Constants.OPT_SHORT_DASH + Constants.VERSION_OPTION_ALIAS) ||
process.argv[process.argv.length - 1] === require.resolve('@zowe/cli');
Expand Down

0 comments on commit 53cc0d0

Please sign in to comment.