balena-cli/lib/ui/patterns/patterns.coffee

20 lines
443 B
CoffeeScript
Raw Normal View History

2014-11-21 17:23:29 +00:00
async = require('async')
2014-12-02 15:08:22 +00:00
fs = require('fs')
2014-11-26 17:27:57 +00:00
widgets = require('../widgets/widgets')
ProgressBar = require('progress')
2014-11-21 17:23:29 +00:00
exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
async.waterfall([
(callback) ->
if confirmAttribute
return callback(null, true)
2014-11-26 17:27:57 +00:00
widgets.confirmRemoval(name, callback)
2014-11-21 17:23:29 +00:00
(confirmed, callback) ->
return callback() if not confirmed
deleteFunction(callback)
], outerCallback)