async run()

in src/commands/bulk/delete.ts [83:109]


  async run() {
    const http = this.http
    if (!http) {
      this.log('No http, no anything.')
      return false
    }

    const { flags, args } = await this.parse(BulkDelete)

    const hardDelete = flags['hard-delete']
    const shouldUnSoftDelete = flags['un-soft-delete']

    const lineCount = await this.countLines(args.input)

    await this.confirmHardDelete(hardDelete)

    const failures = createWriteStream(args.failures)

    const output = createWriteStream(args.output)

    let done = 0
    for await (const id of lines(args.input)) {
      await (shouldUnSoftDelete ? this.unSoftDelete(id, output, failures) : this.delete(id, hardDelete, output, failures))
      const logKeyword = shouldUnSoftDelete ? 'un-soft-deleted' : (hardDelete ? 'hard-deleted' : 'deleted')
      this.log(`Successfully ${logKeyword} ${id} - ${++done} / ${lineCount}`)
    }
  }