File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change 18
18
19
19
path = require ' path'
20
20
fs = require ' fs'
21
+ readline = require ' readline'
21
22
22
23
FuzzyAIClient = require ' fuzzy.ai'
23
24
yargs = require ' yargs'
@@ -54,6 +55,9 @@ argv = yargs
54
55
.describe (' b' , " Batch size" )
55
56
.number (' b' )
56
57
.default (' b' , 128 )
58
+ .boolean (' y' )
59
+ .alias (' y' , ' yes' )
60
+ .describe (' y' , ' Answer "yes" to all questions' )
57
61
.env (' FUZZY_AI' )
58
62
.alias (' c' , ' config' )
59
63
.describe (' c' , ' Config file' )
@@ -213,12 +217,26 @@ handler =
213
217
], callback
214
218
], callback
215
219
delete : (client , argv , callback ) ->
216
- async .waterfall [
217
- (callback ) ->
218
- toID client, argv .agent , callback
219
- (id , callback ) ->
220
- client .deleteAgent id, callback
221
- ], callback
220
+ doDelete = (callback ) ->
221
+ async .waterfall [
222
+ (callback ) ->
223
+ toID client, argv .agent , callback
224
+ (id , callback ) ->
225
+ client .deleteAgent id, callback
226
+ ], callback
227
+
228
+ if argv .y
229
+ doDelete callback
230
+ else
231
+ rl = readline .createInterface
232
+ input : process .stdin
233
+ output : process .stdout
234
+ rl .question " Really delete agent #{ argv .agent } ? " , (answer ) ->
235
+ if answer == " y"
236
+ doDelete callback
237
+ else
238
+ callback null
239
+
222
240
batch : (client , argv , callback ) ->
223
241
id = null
224
242
inputNames = null
You can’t perform that action at this time.
0 commit comments