File tree 1 file changed +10
-2
lines changed
packages/@sanity/core/src/commands/dataset
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,21 @@ export default {
3
3
group : 'dataset' ,
4
4
signature : '[datasetName]' ,
5
5
description : 'Delete a dataset within your project' ,
6
- action : ( args , context ) => {
7
- const { apiClient, output} = context
6
+ action : async ( args , context ) => {
7
+ const { apiClient, prompt , output} = context
8
8
const [ dataset ] = args . argsWithoutOptions
9
9
if ( ! dataset ) {
10
10
throw new Error ( 'Dataset name must be provided' )
11
11
}
12
12
13
+ await prompt . single ( {
14
+ type : 'input' ,
15
+ message : 'Are you ABSOLUTELY sure you want to delete this dataset?\n Type the name of the dataset to confirm delete:' ,
16
+ validate : input => {
17
+ return input === dataset || 'Incorrect dataset name. Ctrl + C to cancel delete.'
18
+ }
19
+ } )
20
+
13
21
return apiClient ( ) . datasets . delete ( dataset ) . then ( ( ) => {
14
22
output . print ( 'Dataset deleted successfully' )
15
23
} )
You can’t perform that action at this time.
0 commit comments