Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesnt work in repl #222

Open
bonny5151 opened this issue Jan 16, 2022 · 3 comments
Open

Doesnt work in repl #222

bonny5151 opened this issue Jan 16, 2022 · 3 comments

Comments

@bonny5151
Copy link

Doesnt work in node repl

@caub
Copy link
Contributor

caub commented Jan 16, 2022

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

@caub
Copy link
Contributor

caub commented Jan 16, 2022

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' }

@bonny5151
Copy link
Author

bonny5151 commented Jan 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants