Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:17:58+00:00 2026-05-31T04:17:58+00:00

js in order to create a command line wizard. The wizard asks some question

  • 0

js in order to create a command line wizard.

The wizard asks some question to the user using the rl.question(query, callback) method.

The problem is that I want to make the question and to provide a default answer in order to let the user able to press enter to confirm the default answer, to edit the default answer or to cancel the default answer and press enter to skip the question.

Something like this:

What’s your favorite color? Red_

if the user press enter: the answer will be Red
if the user change Red to Green: the answer will be Green
if the user cancel Red and press enter: the answer will be “” and the wizard will skip to the next question.

Do You know how to make something like this with Node.js?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:17:59+00:00Added an answer on May 31, 2026 at 4:17 am

    You can use rl.write after rl.question call to add default value to tty.

    Example:

    var readline = require('readline'),
    rl = readline.createInterface(process.stdin, process.stdout);
    
    rl.question('What is your favorite food? ', function(answer) {
            console.log('Oh, so your favorite food is ' + answer);
    });
    rl.write('Pizza');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create a command line application (without an application server) That
I'm using the argh library to create a python command line tool. Several of
I created a j2ee-simple project using the maven template with following command-line mvn archetype:create
Right now I'm using JFreeChart in order to create a dynamic chart. However the
I'm using the openssl utility of debian in order to create a certificate. The
I'm using the following script in my website in order to create pagination next-previous
I've created a custom method called checkout in my app. I create an order
I'm trying to create a hash that preserves the order that the keys are
I have a C# command-line application that I need to run in windows and
I'm trying to learn JPA and I want create a simple Java command line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.