Skip to content

Commit

Permalink
[core] Cast document IDs to string (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed May 24, 2019
1 parent 456388b commit 26e2469
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const os = require('os')
const path = require('path')
const fse = require('fs-extra')
const json5 = require('json5')
const uuid = require('@sanity/uuid')
const execa = require('execa')
const chokidar = require('chokidar')
const {isPlainObject, isEqual, noop} = require('lodash')
const uuid = require('@sanity/uuid')

const helpText = `
Options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export default {
helpText,
description: 'Delete a document by ID',
action: async (args, context) => {
const {apiClient, output} = context
const {apiClient, output, chalk} = context
const {dataset} = args.extOptions
const [id] = args.argsWithoutOptions
const [id] = args.argsWithoutOptions.map(str => `${str}`)

if (!id) {
throw new Error('Document ID must be specified')
Expand All @@ -38,7 +38,7 @@ export default {
if (results.length > 0 && results[0].operation === 'delete') {
output.print('Document deleted')
} else {
output.print(`Document with ID "${id}" not found`)
output.error(chalk.red(`Document with ID "${id}" not found`))
}
} catch (err) {
throw new Error(`Failed to delete document:\n${err.message}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
action: async (args, context) => {
const {apiClient, output, chalk} = context
const {pretty, dataset} = args.extOptions
const [docId] = args.argsWithoutOptions
const [docId] = args.argsWithoutOptions.map(str => `${str}`)

if (!docId) {
throw new Error('Document ID must be specified')
Expand Down

0 comments on commit 26e2469

Please sign in to comment.