Skip to content

Commit

Permalink
fix: display help command
Browse files Browse the repository at this point in the history
  • Loading branch information
loopingz committed Oct 7, 2023
1 parent 5bd6bf8 commit 3d0b790
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion packages/core/src/models/relations.ts
@@ -1,4 +1,3 @@
import { Core } from "../core";
import {
CoreModel,
CoreModelDefinition,
Expand Down
4 changes: 2 additions & 2 deletions packages/gcp/webda.module.json
Expand Up @@ -196,7 +196,7 @@
"retry": {
"anyOf": [
{
"$ref": "#/definitions/Partial%3Cclass-478043683-735-3044-478043683-0-15050%3E"
"$ref": "#/definitions/Partial%3Cclass-657338214-735-3044-657338214-0-15050%3E"
},
{
"type": "null"
Expand Down Expand Up @@ -1134,7 +1134,7 @@
}
}
},
"Partial<class-478043683-735-3044-478043683-0-15050>": {
"Partial<class-657338214-735-3044-657338214-0-15050>": {
"type": "object",
"properties": {
"retryCodes": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hawk/webda.module.json
Expand Up @@ -10,7 +10,7 @@
"links": [
{
"attribute": "_user",
"model": "unknown",
"model": "Webda/User",
"type": "LINK"
}
]
Expand All @@ -36,7 +36,7 @@
"___checker": "(address: string) => boolean",
"origins": "string[]",
"whitelist": "string[]",
"_user": "ModelLink<T>",
"_user": "ModelLink<User>",
"public": "boolean",
"uuid": "string",
"___class": "CoreModelDefinition",
Expand Down
9 changes: 3 additions & 6 deletions packages/shell/src/console/webda.spec.ts
Expand Up @@ -331,9 +331,8 @@ class DynamicService extend Service {
this.logger.setLogLevel("TRACE");
// Test launch aswell
await this.commandLine("launch CustomService");
let logs = this.logger.getLogs();
let ind = logs.length - 2;

let logs = this.logger.getLogs().slice(-2);
let ind = 0;
assert.strictEqual(logs[ind].log.args.length, 1);
assert.strictEqual(logs[ind].log.args[0], "Result: void");
ind++;
Expand Down Expand Up @@ -526,8 +525,7 @@ class DynamicService extend Service {
@test
async types() {
await this.commandLine("types");
let logs = this.logger.getLogs().filter(l => !l.log?.args[0].startsWith("Cannot find logo") && l.log?.level === "INFO");
console.log(logs.map(l => l.log?.level + ": " + l.log?.args.join(" ")).join("\n"));
let logs = this.logger.getLogs().filter(l => !l.log?.args[0].startsWith("Cannot find logo") && !l.log?.args[0].startsWith("[Registry]") && l.log?.level === "INFO");
assert.strictEqual(
logs.length,
4,
Expand All @@ -539,7 +537,6 @@ class DynamicService extend Service {
async stores() {
await this.commandLine("stores");
let logs = this.logger.getLogs().filter(l => l.log?.args[0].startsWith("Store "));
console.log(logs.map(l => l.log?.level + ": " + l.log?.args.join(" ")).join("\n"));
assert.strictEqual(
logs.length,
2,
Expand Down
6 changes: 4 additions & 2 deletions packages/shell/src/console/webda.ts
Expand Up @@ -1170,8 +1170,12 @@ ${Object.keys(operationsExport.operations)
// Load lib
argv._.shift();
result = await this.executeShellExtension(extension, extension.relPath, argv);
} else {
// Display help if nothing is found
this.displayHelp(parser);
}
this.webda?.stop();

return result;
// Would need to create a fake app with a throw exception in a module to generate this
/* c8 ignore next 4 */
Expand All @@ -1187,8 +1191,6 @@ ${Object.keys(operationsExport.operations)
logger.close();
}
}
// Display help if nothing is found
this.displayHelp(parser);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions sample-app/src/services/bean.ts
Expand Up @@ -12,6 +12,8 @@ export class BeanService extends Service {
export class SampleAppBadBean {
@Operation()
operation(context: OperationContext<{ projectId: string }>) {}

async stop() {}
}

@Bean
Expand Down

0 comments on commit 3d0b790

Please sign in to comment.