mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-27 17:18:51 +00:00
41 lines
793 B
CoffeeScript
41 lines
793 B
CoffeeScript
_ = require('lodash')
|
|
inquirer = require('inquirer')
|
|
|
|
exports.table = require('./table/table')
|
|
|
|
exports.login = (callback) ->
|
|
inquirer.prompt([
|
|
{
|
|
type: 'input'
|
|
name: 'username'
|
|
message: 'Username'
|
|
}
|
|
{
|
|
type: 'password'
|
|
name: 'password'
|
|
message: 'Password'
|
|
}
|
|
], _.partial(callback, null))
|
|
|
|
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)
|
|
|
|
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)
|