It would be cool if there would be a way to define drush_prompt to be optional,
so if the user does not input anything just a "" drush continues and not ask again

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new1.88 KB

Here is a patch for it.

dawehner’s picture

StatusFileSize
new831 bytes

wrong patch

moshe weitzman’s picture

Category: support » feature

I'd love some input from anyone who actually uses this function?

dawehner’s picture

I used this patch when i developed http://drupal.org/node/838660#comment-3136766

Perhaps joachim could take a look

greg.1.anderson’s picture

Looks like moshe already committed this... Code looks fine to me. On a semantic level, maybe $optional could be '$blank_input_allowed'? Could use some javadocs.

dawehner’s picture

StatusFileSize
new1.04 KB

Thanks for commiting the patch.

Here is a patch for the docs

moshe weitzman’s picture

Status: Needs review » Fixed

tweaked and committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

joachim’s picture

Component: Code » PM (dl, en, up ...)
Status: Closed (fixed) » Patch (to be ported)

Any chance this could be applied to 3 too?

moshe weitzman’s picture

Status: Patch (to be ported) » Closed (fixed)

sorry, only bug fixes for 3.

joachim’s picture

Status: Closed (fixed) » Active

Having code that actually implements this makes me realize -- having an $optional parameter is backwards. On Drupal, we say 'required' = TRUE.

greg.1.anderson’s picture

Status: Active » Needs review
StatusFileSize
new1.06 KB

That would break all callers who use drush_prompt w/out the default value for that parameter. In drush core, there is only one caller, and it does not specify the last parameter, so this would only break contrib.

There's about one more day, maybe close to two for this to get committed before drush-4 is released; after that, you'll have to wait for drush-5. I'm game, though. Any dissenting opinions?

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

ok with me

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

In it goes, just in time... no need to wait another six months. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.