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 8 months ago

Amorfx commented 3 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 1 year ago

Up for my question.

Or did I miss something ? A function ?

danielbachhuber commented 8 months ago

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

Amorfx commented 8 months 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 8 months 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.