@@ -13,7 +13,7 @@ import { suggestTarget } from './suggest_target'
1313import constants from '../../constants'
1414import { meowOrExit } from '../../utils/meow-with-subcommands'
1515import { getFlagListOutput } from '../../utils/output-formatting'
16- import { getDefaultToken , setupSdk } from '../../utils/sdk'
16+ import { getDefaultToken } from '../../utils/sdk'
1717
1818import type { CliCommandConfig } from '../../utils/meow-with-subcommands'
1919
@@ -172,20 +172,17 @@ async function run(
172172 // If the current cwd is unknown and is used as a repo slug anyways, we will
173173 // first need to register the slug before we can use it.
174174 let repoDefaultBranch = ''
175-
176175 // Only do suggestions with an apiToken and when not in dryRun mode
177176 if ( apiToken && ! dryRun ) {
178- const socketSdk = await setupSdk ( )
179-
180177 if ( ! orgSlug ) {
181- const suggestion = await suggestOrgSlug ( socketSdk )
178+ const suggestion = await suggestOrgSlug ( )
182179 if ( suggestion ) orgSlug = suggestion
183180 updatedInput = true
184181 }
185182
186183 // (Don't bother asking for the rest if we didn't get an org slug above)
187184 if ( orgSlug && ! repoName ) {
188- const suggestion = await suggestRepoSlug ( socketSdk , orgSlug )
185+ const suggestion = await suggestRepoSlug ( orgSlug )
189186 if ( suggestion ) {
190187 repoDefaultBranch = suggestion . defaultBranch
191188 repoName = suggestion . slug
@@ -201,15 +198,15 @@ async function run(
201198 }
202199 }
203200
204- if ( updatedInput ) {
201+ if ( updatedInput && repoName && branchName && orgSlug && targets ?. length ) {
205202 logger . error (
206203 'Note: You can invoke this command next time to skip the interactive questions:'
207204 )
208205 logger . error ( '```' )
209206 logger . error (
210207 ` socket scan create [other flags...] --repo ${ repoName } --branch ${ branchName } ${ orgSlug } ${ targets . join ( ' ' ) } `
211208 )
212- logger . error ( '```' )
209+ logger . error ( '```\n ' )
213210 }
214211
215212 if ( ! orgSlug || ! repoName || ! branchName || ! targets . length ) {
0 commit comments