Skip to content

Commit 854cf4b

Browse files
authored
feat(cli): add hints to commands (#443)
1 parent a4f5834 commit 854cf4b

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/src/lib/autorun/autorun-command.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ export function yargsAutorunCommandObject() {
3838
if (options.upload) {
3939
await upload(options);
4040
} else {
41-
console.warn('Upload skipped because configuration is not set.'); // @TODO log verbose
41+
console.warn('Upload skipped because configuration is not set.');
42+
console.info(
43+
[
44+
'💡 Integrate the portal:',
45+
'- npx code-pushup upload - Run upload to upload the created report to the server',
46+
' https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command',
47+
'- Portal Integration - https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#portal-integration',
48+
'- Upload Command - https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#portal-integration',
49+
].join('\n'),
50+
);
4251
}
4352
},
4453
} satisfies CommandModule;

packages/cli/src/lib/collect/collect-command.ts

+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ export function yargsCollectCommandObject(): CommandModule {
1818
console.info(chalk.bold(CLI_NAME));
1919
console.info(chalk.gray(`Run ${command}...`));
2020
await collectAndPersistReports(options);
21+
const { upload = {} } = args as unknown as Record<
22+
'upload',
23+
object | undefined
24+
>;
25+
if (Object.keys(upload).length === 0) {
26+
console.info(
27+
[
28+
'💡 Visualize your reports:',
29+
'- npx code-pushup upload - Run upload to upload the created report to the server',
30+
' https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command',
31+
'- npx code-pushup autorun - Run collect & upload',
32+
' https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command',
33+
].join('\n'),
34+
);
35+
}
2136
},
2237
} satisfies CommandModule;
2338
}

packages/cli/src/lib/upload/upload-command.ts

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ export function yargsUploadCommandObject() {
1414

1515
const options = args as unknown as UploadOptions;
1616
if (!options.upload) {
17+
console.info(
18+
[
19+
'💡 Integrate the portal:',
20+
'- npx code-pushup upload - Run upload to upload the created report to the server',
21+
' https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command',
22+
'- Portal Integration - https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#portal-integration',
23+
'- Upload Command - https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#portal-integration',
24+
].join('\n'),
25+
);
1726
throw new Error('Upload configuration not set');
1827
}
1928
await upload(options);

0 commit comments

Comments
 (0)