flatiron / prompt

a beautiful command-line prompt for node.js

Home Page:http://github.com/flatiron/prompt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesnt work in repl

bonny5151 opened this issue · comments

Doesnt work in node repl

Can you post a proper issue, with repro code, versions, platform infos? thanks
I maintain this repo for free, hope you understand

indeed it seems the behavior is not good from REPL

> const prompt = require('prompt');
undefined
> const v = await prompt.get({ properties: { weather: { type: 'string', enum: ['bad', 'good', 'decent'] } } })
prompt: weather:  good
undefined
> good
Uncaught ReferenceError: good is not defined

compared to running a file (which is usually how people do)

const prompt = require('prompt');

(async() => {
  const v = await prompt.get({ properties: { weather: { type: 'string', enum: ['bad', 'good', 'decent'] } } });
  console.log(v);
})();
// outputs:
// prompt: weather:  good
// { weather: 'good' }

I did not research what the difference is, but i verified, the prompt-sync npm package does work in the repl. Look in their package for solutions