lib/_cli/cli-util.js
function (title, confirm, callback) {
    var fullTitle = title.indexOf('Confirm') === 0 ? title : 'Enter ' + title
    fullTitle += ':'
    read({
      prompt: fullTitle,
      silent: true
    }, function (error, result) {
      if (error) {
        process.stdout.write('\n')
        callback(provisionUtil.createFormattedDxlError(
          'Error obtaining value for prompt: ' + title))
      } else if (result) {
        if (confirm) {
          module.exports.getValueFromPrompt('Confirm ' + title, false,
            function (error, confirmationResult) {
              if (error) {
                process.stdout.write('\n')
                callback(provisionUtil.createFormattedDxlError(
                  'Error obtaining confirmation value for prompt: ' + title))
              } else if (result === confirmationResult) {
                callback(null, result)
              } else {
                process.stdout.write('Values for ' + title +
                  ' do not match. Try again.\n')
                module.exports.getValueFromPrompt(title, true, callback)
              }
            }
          )
        } else {
          callback(null, result)
        }
      } else {
        process.stdout.write('Value cannot be empty. Try again.\n')
        module.exports.getValueFromPrompt(title, confirm, callback)
      }
    })
  }
function (title, confirm, callback) {
    var fullTitle = title.indexOf('Confirm') === 0 ? title : 'Enter ' + title
    fullTitle += ':'
    read({
      prompt: fullTitle,
      silent: true
    }, function (error, result) {
      if (error) {
        process.stdout.write('\n')
        callback(provisionUtil.createFormattedDxlError(
          'Error obtaining value for prompt: ' + title))
      } else if (result) {
        if (confirm) {
          module.exports.getValueFromPrompt('Confirm ' + title, false,
            function (error, confirmationResult) {
              if (error) {
                process.stdout.write('\n')
                callback(provisionUtil.createFormattedDxlError(
                  'Error obtaining confirmation value for prompt: ' + title))
              } else if (result === confirmationResult) {
                callback(null, result)
              } else {
                process.stdout.write('Values for ' + title +
                  ' do not match. Try again.\n')
                module.exports.getValueFromPrompt(title, true, callback)
              }
            }
          )
        } else {
          callback(null, result)
        }
      } else {
        process.stdout.write('Value cannot be empty. Try again.\n')
        module.exports.getValueFromPrompt(title, confirm, callback)
      }
    })
  }
function ( title , confirm , callback ) { var fullTitle = title . indexOf ( 'Confirm' ) === 0 ? title : 'Enter ' + title fullTitle += ':' read ( { prompt : fullTitle , silent : true } , function ( error , result ) { if ( error ) { process . stdout . write ( '\n' ) callback ( provisionUtil . createFormattedDxlError ( 'Error obtaining value for prompt: ' + title ) ) } else if ( result ) { if ( confirm ) { module . exports . getValueFromPrompt ( 'Confirm ' + title , false , function ( error , confirmationResult ) { if ( error ) { process . stdout . write ( '\n' ) callback ( provisionUtil . createFormattedDxlError ( 'Error obtaining confirmation value for prompt: ' + title ) ) } else if ( result === confirmationResult ) { callback ( null , result ) } else { process . stdout . write ( 'Values for ' + title + ' do not match. Try again.\n' ) module . exports . getValueFromPrompt ( title , true , callback ) } } ) } else { callback ( null , result ) } } else { process . stdout . write ( 'Value cannot be empty. Try again.\n' ) module . exports . getValueFromPrompt ( title , confirm , callback ) } } ) }
Reads a value from standard input. The characters entered by the user
are not echoed to the console.
@param {String} title - Prompt string title to display.
@param {Boolean} confirm - Whether or not to prompt the user to enter the
value a second time before using it. This could be used for validating
the user's selection for sensitive values like passwords.
@param {Function} callback - Callback function to invoke with the value
entered by the user.
Reads a value from standard input . The characters entered by the user are not echoed to the console .