balena-cli/lib/patterns/patterns.coffee

18 lines
387 B
CoffeeScript
Raw Normal View History

2014-11-21 17:23:29 +00:00
async = require('async')
2014-11-26 17:26:01 +00:00
resin = require('../resin')
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:26:01 +00:00
resin.ui.widgets.confirmRemoval(name, callback)
2014-11-21 17:23:29 +00:00
(confirmed, callback) ->
return callback() if not confirmed
deleteFunction(callback)
], outerCallback)