async function retrieveAuth(initialSelected) {
  let authData
  const authFile = `${OP_CONFIG}/${AUTH_FILE_NAME}`
  if (!fs.existsSync(authFile)) {
    authData = await promptForAuth()
    return authData
  }
  authData = JSON.parse(fs.readFileSync(authFile, 'utf8'))

  // The user selected a job at runtime, so assume the old auth is desired
  if (initialSelected) return authData

  const { useOld } = await ux.prompt(useOldAuthPrompt)
  if (!useOld) {
    authData = await promptForAuth()
    return authData
  }

  if (!Object.keys(authData).length) {
    authData = await promptForAuth()
  }

  return authData
}
/**
 * retrieveAuth checks for previously defined authentication configurations.
 *
 * @param {boolean} initialSelected The user selected a job at runtime
 *
 * @return {object} The stored auth config key/values or an empty object
 */
retrieveAuth checks for previously defined authentication configurations.
@param {boolean} initialSelected The user selected a job at runtime

@return {object} The stored auth config key/values or an empty object
retrieveAuth checks for previously defined authentication configurations . @param { boolean } initialSelected The user selected a job at runtime @return { object } The stored auth config key / values or an empty object
async function retrieveAuth(initialSelected) {
  let authData
  const authFile = `${OP_CONFIG}/${AUTH_FILE_NAME}`
  if (!fs.existsSync(authFile)) {
    authData = await promptForAuth()
    return authData
  }
  authData = JSON.parse(fs.readFileSync(authFile, 'utf8'))
  if (initialSelected) return authData
  const { useOld } = await ux.prompt(useOldAuthPrompt)
  if (!useOld) {
    authData = await promptForAuth()
    return authData
  }
  if (!Object.keys(authData).length) {
    authData = await promptForAuth()
  }
  return authData
}
async function retrieveAuth ( initialSelected ) { let authData const authFile = ` ${ OP_CONFIG } ${ AUTH_FILE_NAME } ` if ( ! fs . existsSync ( authFile ) ) { authData = await promptForAuth ( ) return authData } authData = JSON . parse ( fs . readFileSync ( authFile , 'utf8' ) ) if ( initialSelected ) return authData const { useOld } = await ux . prompt ( useOldAuthPrompt ) if ( ! useOld ) { authData = await promptForAuth ( ) return authData } if ( ! Object . keys ( authData ) . length ) { authData = await promptForAuth ( ) } return authData }
retrieveAuth checks for previously defined authentication configurations.
retrieveAuth checks for previously defined authentication configurations .
// The user selected a job at runtime, so assume the old auth is desired