@@ -17,9 +17,9 @@ export const stream = {
17
17
18
18
const input = setupCommand ( name , stream . description , argv , importMeta )
19
19
if ( input ) {
20
- const spinnerText = 'Streaming full scan...'
20
+ const spinnerText = 'Streaming full scan... \n '
21
21
const spinner = ora ( spinnerText ) . start ( )
22
- await getOrgFullScan ( input . orgSlug , input . fullScanId , spinner )
22
+ await getOrgFullScan ( input . orgSlug , input . fullScanId , input . file , spinner )
23
23
}
24
24
}
25
25
}
@@ -32,6 +32,7 @@ export const stream = {
32
32
* @property {boolean } outputMarkdown
33
33
* @property {string } orgSlug
34
34
* @property {string } fullScanId
35
+ * @property {string | undefined } file
35
36
*/
36
37
37
38
/**
@@ -48,13 +49,13 @@ function setupCommand (name, description, argv, importMeta) {
48
49
49
50
const cli = meow ( `
50
51
Usage
51
- $ ${ name } <org slug> <full scan ID>
52
+ $ ${ name } <org slug> <full scan ID> <file>
52
53
53
54
Options
54
55
${ printFlagList ( flags , 6 ) }
55
56
56
57
Examples
57
- $ ${ name } FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
58
+ $ ${ name } FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
58
59
` , {
59
60
argv,
60
61
description,
@@ -73,12 +74,14 @@ function setupCommand (name, description, argv, importMeta) {
73
74
74
75
const orgSlug = cli . input [ 0 ] || ''
75
76
const fullScanId = cli . input [ 1 ] || ''
77
+ const file = cli . input [ 2 ]
76
78
77
79
return {
78
80
outputJson,
79
81
outputMarkdown,
80
82
orgSlug,
81
- fullScanId
83
+ fullScanId,
84
+ file
82
85
}
83
86
}
84
87
@@ -90,21 +93,23 @@ function setupCommand (name, description, argv, importMeta) {
90
93
/**
91
94
* @param {string } orgSlug
92
95
* @param {string } fullScanId
96
+ * @param {string|undefined } file
93
97
* @param {import('ora').Ora } spinner
94
98
* @returns {Promise<void|FullScanData> }
95
99
*/
96
- async function getOrgFullScan ( orgSlug , fullScanId , spinner ) {
100
+ async function getOrgFullScan ( orgSlug , fullScanId , file , spinner ) {
97
101
const socketSdk = await setupSdk ( getDefaultKey ( ) )
98
- const result = await handleApiCall ( socketSdk . getOrgFullScan ( orgSlug , fullScanId ) , 'Streaming a full scan' )
102
+ // @ts -ignore
103
+ const result = await handleApiCall ( socketSdk . getOrgFullScan ( orgSlug , fullScanId , file ) , 'Streaming a full scan' )
99
104
100
- if ( ! result . success ) {
105
+ if ( ! result ? .success ) {
101
106
return handleUnsuccessfulApiResponse ( 'getOrgFullScan' , result , spinner )
102
107
}
103
108
104
- console . log ( '\n Full scan details: \n' )
105
-
106
109
spinner . stop ( )
107
110
111
+ console . log ( file ? `\nFull scan details written to ${ file } \n` : '\nFull scan details: \n' )
112
+
108
113
return {
109
114
data : result . data
110
115
}
0 commit comments