Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate getZoweYargsResponse #1962

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/imperative/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## Recent Changes

- Enhancement: Deprecated function AbstractCommandYargs.getBrightYargsResponse in favor of AbstractCommandYargs.getZoweYargsResponse
- Enhancement: Deprecated the 'bright' command as an alias for the 'zowe' command. The 'bright' command will be removed in Zowe V3.

## `5.18.4`

- BugFix: Removed out of date `Perf-Timing` performance timing package.
Expand Down
20 changes: 15 additions & 5 deletions packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@
*/
public abstract defineCommandToYargs(commandExecuted: YargsCommandCompleted): void;

/**
* @deprecated Use `getZoweYargsResponse` instead
*/
protected getBrightYargsResponse(successful: boolean, responseMessage: string,

Check warning on line 246 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L246

Added line #L246 was not covered by tests
action: ImperativeYargsCommandAction,
responses?: ICommandResponse[]): IYargsResponse

Check warning on line 248 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L248

Added line #L248 was not covered by tests
{
return this.getZoweYargsResponse(successful, responseMessage, action, responses);

Check warning on line 250 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L250

Added line #L250 was not covered by tests
}

/**
* Build The Bright Yargs response for the callback. Includes the Bright command response and status info.
* @param {boolean} successful: True if the command succeeded
Expand All @@ -248,7 +258,7 @@
* @param {ICommandResponse[]} responses
* @return {IYargsResponse}
*/
protected getBrightYargsResponse(successful: boolean, responseMessage: string,
protected getZoweYargsResponse(successful: boolean, responseMessage: string,

Check warning on line 261 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L261

Added line #L261 was not covered by tests
action: ImperativeYargsCommandAction,
responses?: ICommandResponse[]): IYargsResponse {
let exitCode: number;
Expand Down Expand Up @@ -309,7 +319,7 @@
stream: ImperativeConfig.instance.daemonContext?.stream
}));
} catch (helpErr) {
const errorResponse: IYargsResponse = this.getBrightYargsResponse(false,
const errorResponse: IYargsResponse = this.getZoweYargsResponse(false,

Check warning on line 322 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L322

Added line #L322 was not covered by tests
`The help for ${this.definition.name} was invoked and failed.`,
"help invoked");
errorResponse.causeErrors = helpErr;
Expand All @@ -318,7 +328,7 @@
}

if (!invoked) {
commandExecuted(args, this.getBrightYargsResponse(true,
commandExecuted(args, this.getZoweYargsResponse(true,

Check warning on line 331 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L331

Added line #L331 was not covered by tests
`The help for ${this.definition.name} was invoked.`,
"help invoked", [response]));
}
Expand Down Expand Up @@ -423,7 +433,7 @@
})
);
} catch (helpErr) {
const errorResponse: IYargsResponse = this.getBrightYargsResponse(false,
const errorResponse: IYargsResponse = this.getZoweYargsResponse(false,

Check warning on line 436 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L436

Added line #L436 was not covered by tests
`The web help for ${this.definition.name} was invoked and failed.`,
"help invoked");
errorResponse.causeErrors = helpErr;
Expand All @@ -432,7 +442,7 @@
}

if (!invoked) {
commandExecuted(args, this.getBrightYargsResponse(true,
commandExecuted(args, this.getZoweYargsResponse(true,

Check warning on line 445 in packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts#L445

Added line #L445 was not covered by tests
`The web help for ${this.definition.name} was invoked.`,
"help invoked", [response]));
}
Expand Down
6 changes: 3 additions & 3 deletions packages/imperative/src/cmd/src/yargs/CommandYargs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@
*/
this.invokeHandlers(handlerDefinition, 0, argsForHandler, responses)
.then((successResponses) => {
commandExecuted(argsForHandler, this.getBrightYargsResponse(true,
commandExecuted(argsForHandler, this.getZoweYargsResponse(true,

Check warning on line 140 in packages/imperative/src/cmd/src/yargs/CommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/CommandYargs.ts#L140

Added line #L140 was not covered by tests
`${successResponses.length} command handlers invoked.`,
"command handler invoked", successResponses));

})
.catch((errorResponses) => {
const response: IYargsResponse = this.getBrightYargsResponse(false,
const response: IYargsResponse = this.getZoweYargsResponse(false,

Check warning on line 146 in packages/imperative/src/cmd/src/yargs/CommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/CommandYargs.ts#L146

Added line #L146 was not covered by tests
`Error in command ${this.definition.name}`,
"command handler invoked", errorResponses);
this.log.error(`Error in command ${this.definition.name}`);
Expand All @@ -155,7 +155,7 @@
* No handlers were present - Respond with an error - this condition should not occur if the
* definition was validated against the schema.
*/
const response: IYargsResponse = this.getBrightYargsResponse(false,
const response: IYargsResponse = this.getZoweYargsResponse(false,

Check warning on line 158 in packages/imperative/src/cmd/src/yargs/CommandYargs.ts

View check run for this annotation

Codecov / codecov/patch

packages/imperative/src/cmd/src/yargs/CommandYargs.ts#L158

Added line #L158 was not covered by tests
`No handlers provided for ${this.definition.name}`,
"command handler invoked");
commandExecuted(argsForHandler, response);
Expand Down