@@ -4,7 +4,13 @@ import {
44 CollectAndPersistReportsOptions ,
55 collectAndPersistReports ,
66} from '@code-pushup/core' ;
7+ import { link } from '@code-pushup/utils' ;
78import { CLI_NAME } from '../constants' ;
9+ import {
10+ collectSuccessfulLog ,
11+ renderConfigureCategoriesHint ,
12+ ui ,
13+ } from '../implementation/logging' ;
814import { yargsOnlyPluginsOptionsDefinition } from '../implementation/only-plugins.options' ;
915
1016export function yargsCollectCommandObject ( ) : CommandModule {
@@ -15,33 +21,51 @@ export function yargsCollectCommandObject(): CommandModule {
1521 builder : yargsOnlyPluginsOptionsDefinition ( ) ,
1622 handler : async < T > ( args : ArgumentsCamelCase < T > ) => {
1723 const options = args as unknown as CollectAndPersistReportsOptions ;
18- console . info ( chalk . bold ( CLI_NAME ) ) ;
19- console . info ( chalk . gray ( `Run ${ command } ...` ) ) ;
24+ ui ( ) . logger . log ( chalk . bold ( CLI_NAME ) ) ;
25+ ui ( ) . logger . info ( chalk . gray ( `Run ${ command } ...` ) ) ;
26+
2027 await collectAndPersistReports ( options ) ;
28+ collectSuccessfulLog ( ) ;
2129
2230 if ( options . categories . length === 0 ) {
23- console . info (
24- chalk . gray (
25- '💡 Configure categories to see the scores in an overview table. See: https://github.com/code-pushup/cli/blob/main/packages/cli/README.md' ,
26- ) ,
27- ) ;
31+ renderConfigureCategoriesHint ( ) ;
2832 }
2933
3034 const { upload = { } } = args as unknown as Record <
3135 'upload' ,
3236 object | undefined
3337 > ;
3438 if ( Object . keys ( upload ) . length === 0 ) {
35- console . info (
36- [
37- '💡 Visualize your reports:' ,
38- '- npx code-pushup upload - Run upload to upload the created report to the server' ,
39- ' https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command' ,
40- '- npx code-pushup autorun - Run collect & upload' ,
41- ' https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command' ,
42- ] . join ( '\n' ) ,
43- ) ;
39+ renderUploadAutorunHint ( ) ;
4440 }
4541 } ,
4642 } satisfies CommandModule ;
4743}
44+
45+ export function renderUploadAutorunHint ( ) : void {
46+ ui ( )
47+ . sticker ( )
48+ . add ( chalk . bold ( chalk . gray ( '💡 Visualize your reports' ) ) )
49+ . add ( '' )
50+ . add (
51+ `${ chalk . gray ( '❯' ) } npx code-pushup upload - ${ chalk . gray (
52+ 'Run upload to upload the created report to the server' ,
53+ ) } `,
54+ )
55+ . add (
56+ ` ${ link (
57+ 'https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command' ,
58+ ) } `,
59+ )
60+ . add (
61+ `${ chalk . gray ( '❯' ) } npx code-pushup autorun - ${ chalk . gray (
62+ 'Run collect & upload' ,
63+ ) } `,
64+ )
65+ . add (
66+ ` ${ link (
67+ 'https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command' ,
68+ ) } `,
69+ )
70+ . render ( ) ;
71+ }
0 commit comments