2014-11-18 16:14:48 +00:00
|
|
|
_ = require('lodash')
|
|
|
|
inquirer = require('inquirer')
|
|
|
|
|
2014-11-26 17:20:56 +00:00
|
|
|
exports.table = require('./table/table')
|
|
|
|
|
2014-11-18 16:14:48 +00:00
|
|
|
exports.login = (callback) ->
|
|
|
|
inquirer.prompt([
|
|
|
|
{
|
|
|
|
type: 'input'
|
|
|
|
name: 'username'
|
|
|
|
message: 'Username'
|
|
|
|
}
|
|
|
|
{
|
|
|
|
type: 'password'
|
|
|
|
name: 'password'
|
|
|
|
message: 'Password'
|
|
|
|
}
|
|
|
|
], _.partial(callback, null))
|
2014-11-21 13:43:03 +00:00
|
|
|
|
2014-11-24 12:45:15 +00:00
|
|
|
exports.select = (message, list, callback) ->
|
|
|
|
inquirer.prompt [
|
|
|
|
{
|
|
|
|
type: 'list'
|
|
|
|
name: 'option'
|
|
|
|
message: message or 'Select an option'
|
|
|
|
choices: list
|
|
|
|
}
|
|
|
|
], (response) ->
|
|
|
|
return callback(null, response.option)
|
|
|
|
|
2014-11-21 13:43:03 +00:00
|
|
|
exports.confirmRemoval = (name, callback) ->
|
|
|
|
inquirer.prompt [
|
|
|
|
{
|
|
|
|
type: 'confirm'
|
|
|
|
name: 'confirmed'
|
|
|
|
message: "Are you sure you want to delete the #{name}?"
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
], (response) ->
|
|
|
|
return callback(null, response.confirmed)
|