Skip to content

Commit

Permalink
feat: add metadata for some remaining commands (#1431)
Browse files Browse the repository at this point in the history
Co-authored-by: asyncapi-bot <bot+chan@asyncapi.io>
  • Loading branch information
peter-rr and asyncapi-bot authored Jun 5, 2024
1 parent f2b337d commit 1499830
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/commands/config/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export default class Analytics extends Command {
if (flags.disable) {
analyticsConfigFileContent.analyticsEnabled = 'false';
this.log('\nAnalytics disabled.\n');
this.metricsMetadata.analytics_disabled = flags.disable;
} else if (flags.enable) {
analyticsConfigFileContent.analyticsEnabled = 'true';
this.log('\nAnalytics enabled.\n');
this.metricsMetadata.analytics_enabled = flags.enable;
} else if (!flags.status) {
this.log('\nPlease append the "--disable" flag to the command in case you prefer to disable analytics, or use the "--enable" flag if you want to enable analytics back again. In case you do not know the analytics current status, then you can append the "--status" flag to be aware of it.\n');
return;
Expand All @@ -41,6 +43,7 @@ export default class Analytics extends Command {
} else {
this.log('\nAnalytics are disabled. Please append the "--enable" flag to the command in case you prefer to enable analytics.\n');
}
this.metricsMetadata.analytics_status_checked = flags.status;
}
} catch (e: any) {
switch (e.code) {
Expand Down
6 changes: 6 additions & 0 deletions src/commands/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export default class Diff extends Command {
checkAndWarnFalseFlag(outputFormat, markdownSubtype);
markdownSubtype = setDefaultMarkdownSubtype(outputFormat, markdownSubtype) as string;

this.metricsMetadata.output_format = outputFormat;
this.metricsMetadata.output_type = outputType;
if (outputFormat === 'md') {
this.metricsMetadata.output_markdown_subtype = flags['markdownSubtype'];
}

try {
firstDocument = await load(firstDocumentPath);

Expand Down
4 changes: 4 additions & 0 deletions src/commands/new/glee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ export default class NewGlee extends Command {
projectName,
forceWrite
);
this.specFile = await load(flags.file);
this.metricsMetadata.template = flags.template;
} else {
try {
await fPromises.mkdir(PROJECT_DIRECTORY);
Expand Down Expand Up @@ -258,6 +260,8 @@ export default class NewGlee extends Command {
`Unable to create the project. Please check the following message for further info about the error:\n\n${err}`
);
}
this.specFile = await load(`${GLEE_TEMPLATES_DIRECTORY}/asyncapi.yaml`);
this.metricsMetadata.template = flags.template;
}
}
}
3 changes: 3 additions & 0 deletions src/commands/start/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export default class StartStudio extends Command {
const { flags } = await this.parse(StartStudio);
const filePath = flags.file || (await load()).getFilePath();
const port = flags.port;

this.specFile = await load(filePath);
this.metricsMetadata.port = port;

startStudio(filePath as string, port);
}
Expand Down

0 comments on commit 1499830

Please sign in to comment.