Skip to content

override property to bypass prompt. #6

Closed
dominictarr opened this Issue Jun 29, 2011 · 4 comments

4 participants

@dominictarr

Although prompting is a good UX for first time users, power users may prefer passing in all the options as cli arguments.

I propose adding prompt.override which could be used to achive this:

prompt.override = {name: 'whoever'}

prompt.get(['name'], function (err,answer){
   //it will just take name from .override and not prompt the user. 
})

Then it would be a one line change to add this feature to all the nodejitsu cli tools, prompt.override = optimist.argv

the option would still be validated, and would call back an error if it failed.

@bmeck
a decoupled application framework member
bmeck commented Jun 29, 2011
@dominictarr

it's certainly possible. but I don't think there are currently any collisions in the nodejitsu cli tools.

can you think of any?

@jfhbrook
jfhbrook commented Aug 2, 2011

My first intuition is that you could easily get around needing this by doing something like:

    (function (cb) {
        if (argv.name) {
            cb(null, argv.name);
        } else {
            prompt.get(['name'], cb);
        }
    })(function(err, name) {
        //. . .
    });

...but then I realize that, despite having mixed feelings about the prompt.override interface a'priori, it'd certainly be cleaner than having no way to avoid the text mess above.

@dominictarr dominictarr added a commit to dominictarr/node-prompt that referenced this issue Aug 19, 2011
@dominictarr dominictarr [minor] support override (close issue #6) ec85235
@indexzero
a decoupled application framework member

This is fixed in prompt@0.1.7

@indexzero indexzero closed this Aug 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.