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

Option to disable property name logging in prompt

m-Phoenix852 opened this issue · comments

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