File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -4,19 +4,15 @@ import chalk from 'chalk';
4
4
5
5
export class Commands {
6
6
public static printEndpoints ( endpoints : Endpoint [ ] ) {
7
- const paths = endpoints . map ( ( item ) => {
8
- let path = item . type + ' ' + item . path ;
9
- const queryKeys = Object . keys ( item . query ) ;
10
- if ( queryKeys . length ) {
11
- path += ' query: ' + queryKeys ;
12
- }
13
- const bodyKeys = Object . keys ( item . body ) ;
14
- if ( bodyKeys . length ) {
15
- path += ' body: ' + bodyKeys ;
16
- }
17
- return path ;
7
+ endpoints . forEach ( ( endpoint ) => {
8
+ console . log ( chalk . cyan ( '➜ ' ) + chalk . bold . cyan ( endpoint . path ) ) ;
9
+ Object . keys ( endpoint . body ) . length > 0 &&
10
+ console . log ( ' ' + chalk . bold . yellow ( 'body: ' ) + Object . keys ( endpoint . body ) . join ( ', ' ) ) ;
11
+ Object . keys ( endpoint . query ) . length > 0 &&
12
+ console . log ( ' ' + chalk . bold . yellow ( 'query: ' ) + Object . keys ( endpoint . query ) . join ( ', ' ) ) ;
13
+ Object . keys ( endpoint . headers ) . length > 0 &&
14
+ console . log ( ' ' + chalk . bold . yellow ( 'headers: ' ) + Object . keys ( endpoint . headers ) . join ( ', ' ) ) ;
18
15
} ) ;
19
- console . log ( paths ) ;
20
16
}
21
17
22
18
public static generatePostmanCollection ( collectionName : string , endpoints : Endpoint [ ] ) {
You can’t perform that action at this time.
0 commit comments