How to use the prompt.logger function in prompt

To help you get started, we’ve selected a few prompt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kkemple / tasker / encryption.js View on Github external
var fs = require('fs'),
    crypto = require('crypto'),
    prompt = require('prompt'),
    shell = require('shelljs');

// check for .password file, if not there do the encryption thing
if (!shell.test('-f', '.password')) {

    prompt.logger.info('Creating encryption passkey for JIRA login');
    fs.writeFileSync('.password', '');
    shell.exec('openssl rand -base64 48', {silent: true}).output.to('./password');
}

var passKey = fs.readFileSync('.password').toString('utf8').trim();

module.exports = {
    encrypt: function (text) {
        var cipher = crypto.createCipher('aes-256-cbc', passKey);
        var crypted = cipher.update(crypto.randomBytes(10).toString('base64') + '.' + text,'utf8','hex');
        crypted += cipher.final('hex');
        return crypted;
    },
    decrypt: function (text) {
        var decipher = crypto.createDecipher('aes-256-cbc', passKey);
        var dec = decipher.update(text,'hex','utf8');
github kkemple / tasker / install.js View on Github external
prompt.get(schema, function (err, result) {

    // check for data dir, if not found build files/folders
    if (!shell.test('-d', 'data')) {
        prompt.logger.info('Creating `data` directory');
        shell.mkdir('data');

        prompt.logger.info('Creating `data/stats.json` file');
        fs.writeFileSync('data/stats.json', JSON.stringify({
            jira: {}
        }));

        prompt.logger.info('Creating `data/user.json` file');
        fs.writeFileSync('data/user.json', JSON.stringify({
            id: 1,
            allowBrowserNotifications: false,
            allowVoiceNotifications: false,
            allowVoiceCommands: false,
            notificationDuration: 10,
            backupDuration: 60,
            screenCaptureDuration: 10,
            allowScreenCapture: false,
            screenCaptureStartTime: '9:00 AM',
            screenCaptureEndTime: '5:00 PM',
github kkemple / tasker / install.js View on Github external
description: 'Please enter your JIRA username (not email address)'
        },
        password: {
            hidden: true,
            description: 'Please enter your JIRA password (password is encrypted)'
        },
        url: {
            pattern: /.+\/$/,
            message: 'JIRA url must have trailing slash ("/")',
            required: true,
            description: 'Please enter your JIRA url (include the trailing slash ("http://jiraurl.com/")'
        }
    }
}

prompt.logger.info('Starting install...\n');

prompt.get(schema, function (err, result) {

    // check for data dir, if not found build files/folders
    if (!shell.test('-d', 'data')) {
        prompt.logger.info('Creating `data` directory');
        shell.mkdir('data');

        prompt.logger.info('Creating `data/stats.json` file');
        fs.writeFileSync('data/stats.json', JSON.stringify({
            jira: {}
        }));

        prompt.logger.info('Creating `data/user.json` file');
        fs.writeFileSync('data/user.json', JSON.stringify({
            id: 1,
github kkemple / tasker / install.js View on Github external
/**
 *
 * Check for installed required software
 * Warn about sudo issues: give links
 *
 */

if (!shell.which('grunt')) {
    prompt.logger.error('You need to install grunt-cli globally :: http://gruntjs.com/getting-started');
    prompt.logger.warn('If you get access errors, you need to set the proper permissions on your node_modules folder =>');
    prompt.logger.info('   http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo');
    return;
}

if (!shell.which('bower')) {
    prompt.logger.error('You need to install bower globally :: http://bower.io/');
    prompt.logger.warn('If you get access errors, you need to set the proper permissions on your node_modules folder =>');
    prompt.logger.info('   http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo');
    return;
}

var schema = {
    properties: {
        username: {
            required: true,
            description: 'Please enter your JIRA username (not email address)'
        },
        password: {
            hidden: true,
            description: 'Please enter your JIRA password (password is encrypted)'
        },
        url: {