-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
b595de1
commit e134b35
Showing
6 changed files
with
39 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
// @ts-nocheck | ||
/* eslint-disable no-console */ | ||
|
||
import meow from 'meow' | ||
import ora from 'ora' | ||
|
||
import { outputFlags, validationFlags } from '../../flags/index.js' | ||
import { handleApiCall } from '../../utils/api-helpers.js' | ||
import { outputFlags } from '../../flags/index.js' | ||
import { handleApiCall, handleUnsuccessfulApiResponse } from '../../utils/api-helpers.js' | ||
import { printFlagList } from '../../utils/formatting.js' | ||
import { getDefaultKey, setupSdk } from '../../utils/sdk.js' | ||
|
||
|
@@ -28,10 +27,8 @@ export const create = { | |
|
||
/** | ||
* @typedef CommandContext | ||
* @property {boolean} includeAllIssues | ||
* @property {boolean} outputJson | ||
* @property {boolean} outputMarkdown | ||
* @property {boolean} strict | ||
*/ | ||
|
||
/** | ||
|
@@ -43,20 +40,15 @@ export const create = { | |
*/ | ||
function setupCommand (name, description, argv, importMeta) { | ||
const flags = { | ||
...outputFlags, | ||
...validationFlags, | ||
...outputFlags | ||
} | ||
|
||
const cli = meow(` | ||
Usage | ||
$ ${name} <name> | ||
$ ${name} | ||
Options | ||
${printFlagList(flags, 6)} | ||
Examples | ||
$ ${name} webtorrent | ||
$ ${name} [email protected] | ||
`, { | ||
argv, | ||
description, | ||
|
@@ -65,23 +57,19 @@ function setupCommand (name, description, argv, importMeta) { | |
}) | ||
|
||
const { | ||
all: includeAllIssues, | ||
json: outputJson, | ||
markdown: outputMarkdown, | ||
strict, | ||
markdown: outputMarkdown | ||
} = cli.flags | ||
|
||
return { | ||
includeAllIssues, | ||
outputJson, | ||
outputMarkdown, | ||
strict, | ||
outputMarkdown | ||
} | ||
} | ||
|
||
/** | ||
* @typedef PackageData | ||
* @property {import('@socketsecurity/sdk').SocketSdkReturnType<'createOrgFullScan'>["data"]} data | ||
* @property {import('@socketsecurity/sdk').SocketSdkReturnType<'CreateOrgFullScan'>["data"]} data | ||
*/ | ||
|
||
/** | ||
|
@@ -98,9 +86,13 @@ async function createFullScan (spinner) { | |
tmp: true | ||
}, ['package.json']), 'Creating full scan') | ||
|
||
console.log(result) | ||
if (!result.success) { | ||
return handleUnsuccessfulApiResponse('CreateOrgFullScan', result, spinner) | ||
} | ||
|
||
// console.log('RES: ', result.data) | ||
console.log('\n Full scan created successfully \n') | ||
console.log('Full scan details: \n') | ||
console.log(result.data) | ||
|
||
spinner.stop() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters