Advertisement
Guest User

Untitled

a guest
May 21st, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. diff --git a/index.js b/index.js
  2. index 11b46ac..4cf1473 100644
  3. --- a/index.js
  4. +++ b/index.js
  5. @@ -1,6 +1,7 @@
  6. #!/usr/bin/env node
  7.  
  8. const cli = require('cac')('txtl')
  9. +var readline = require('readline')
  10.  
  11. const { log } = console
  12.  
  13. @@ -8,6 +9,19 @@ const { log } = console
  14. cli.command('', 'Starts an interactive chat session in a thread.')
  15. .action((opts) => {
  16. log('do something')
  17. + // Specify our readline interface
  18. + const rl = readline.createInterface({
  19. + input: process.stdin,
  20. + output: process.stdout,
  21. + terminal: false
  22. + })
  23. + // Run callback for each input on stdin
  24. + rl.on('line', (line) => {
  25. + if (line !== '') {
  26. + log(line)
  27. + rl.prompt()
  28. + }
  29. + })
  30. })
  31. .option('--thread [thread]', 'Thread ID. Omit to use the \'default\' thread.', {
  32. default: 'default',
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement