balena-cli/lib/resin/ui/patterns/patterns.coffee
2014-11-26 13:29:19 -04:00

18 lines
390 B
CoffeeScript

async = require('async')
widgets = require('../widgets/widgets')
exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
async.waterfall([
(callback) ->
if confirmAttribute
return callback(null, true)
widgets.confirmRemoval(name, callback)
(confirmed, callback) ->
return callback() if not confirmed
deleteFunction(callback)
], outerCallback)