wp-cli / ideas

💡 Ideas and feature requests are collected here
40 stars 1 forks source link

Add into internal API a function called ask() #155

Closed Amorfx closed 1 year ago

Amorfx commented 4 years ago

I want to create some commands with WP-CLI but i did not find a function in order to request information by the user.

Is it possible to imagine adding an ask() function used this way: $someInformation = WP_CLI::ask($question) like the question helper from Symfony ?

Amorfx commented 2 years ago

Up for my question.

Or did I miss something ? A function ?

danielbachhuber commented 1 year ago

We have WP_CLI::confirm() https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-confirm/

Amorfx commented 1 year ago

@danielbachhuber Confirm just allows a barrier to exit the script or not but does not allow you to request information such as a string like "What is your name ?"

danielbachhuber commented 1 year ago

@Amorfx Correct. We haven't had a need for that use case, so we haven't implemented it. You're welcome to use whichever external library you'd like for it.