balena-cli/lib/ui/patterns/patterns.coffee
2015-01-08 09:39:38 -03:00

20 lines
443 B
CoffeeScript

async = require('async')
fs = require('fs')
widgets = require('../widgets/widgets')
ProgressBar = require('progress')
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)