Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var prompt = require('cli-prompt');
  2.  
  3. cli = prompt({
  4. infinite: false,
  5. format: 'pryjs> '
  6. })
  7. cli.on('value', function(input) {
  8. if (input[0] === 'close') {
  9. console.log('closing..', input);
  10. cli.close();
  11. var ps = prompt({
  12. prompt: 'blaine'
  13. });
  14. follower = null;
  15. ps.multiline({prompt: {format: '----> '}, key: function(input) {
  16. if (input === '\r' && follower === input) {
  17. return true;
  18. }
  19. follower = input;
  20. return false;
  21. }}, function(err, lines, raw) {
  22. console.log('value', raw);
  23. ps.close();
  24. cli = prompt({
  25. infinite: false,
  26. format: 'pryjs> '
  27. })
  28. cli.on('value', function(input) {
  29. if (input[0] === 'close') {
  30. console.log('closing..', input);
  31. cli.close();
  32. // finisheddddddd
  33. } else {
  34. console.log('opening..', input);
  35. cli.run();
  36. }
  37. });
  38. cli.run();
  39. });
  40. } else {
  41. console.log('opening..', input);
  42. cli.run();
  43. }
  44. });
  45. cli.run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement