Option to disable property name logging in prompt
m-Phoenix852 opened this issue · comments
How do I disable the property name, this explain https://stackoverflow.com/questions/41901072/node-js-prompt-how-to-disable-the-appearance-of-the-property-name#comment70985144_41901266
Can you post some code so I can reproduce your error?
Can you post some code so I can reproduce your error?
its not a error, I want to know how to disable the "prompt" string that is printed by the module with the prompt name whenever you prompt.get()
looking at the source, you can probably override it with prompt.message = '';
https://github.com/flatiron/prompt/blob/master/lib/prompt.js#L47
looking at the source, you can probably override it with
prompt.message = '';
https://github.com/flatiron/prompt/blob/master/lib/prompt.js#L47
I tried that, doesn't work
can you show some code?
it works just fine for me, e.g.:
const prompt = require('prompt');
prompt.message = '';
const { code } = await prompt.get({
properties: {
code: {
type: 'string',
required: true,
},
}
});
outputs:
code:
can you show some code?
it works just fine for me, e.g.:
const prompt = require('prompt'); prompt.message = ''; const { code } = await prompt.get({ properties: { code: { type: 'string', required: true, }, } });outputs:
code:
Oh, how to remove the "code: " message
That doesn't sound like a good idea to remove any prefix, in terms of UX, but you could probably go with
const prompt=require('prompt');
prompt.message='';
prompt.delimiter='';
const data = await prompt.get(' '); // or prompt.get('\u200B'); because empty string seems to complain
just try out what works for you, I don't know much more about prompt than you, I just read the docs and the small source code to answer you