Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printed command using --prompt for wp user create is missing user-login and user-email #433

Closed
2 tasks done
2ndkauboy opened this issue Nov 10, 2023 · 3 comments
Closed
2 tasks done

Comments

@2ndkauboy
Copy link

Bug Report

Describe the current, buggy behavior

I sometimes create a user with wp user create --prompt. After running this command, you will see the command you could have used - without using the --prompt, but it's missing the required parameters user-login and user-email, as seen here (second last line):

$ wp user create --prompt
1/15 <user-login>: john
2/15 <user-email>: john@example.com
3/15 [--role=<role>]: administrator
4/15 [--user_pass=<password>]: wordpress
5/15 [--user_registered=<yyyy-mm-dd-hh-ii-ss>]: 
6/15 [--display_name=<name>]: 
7/15 [--user_nicename=<nice_name>]: 
8/15 [--user_url=<url>]: 
9/15 [--nickname=<nickname>]: 
10/15 [--first_name=<first_name>]: 
11/15 [--last_name=<last_name>]: 
12/15 [--description=<description>]: 
13/15 [--rich_editing=<rich_editing>]: 
14/15 [--send-email] (Y/n): 
15/15 [--porcelain] (Y/n): 
wp user create --role='administrator' --user_pass='wordpress'
Success: Created user 4.

Describe how other contributors can replicate this bug

  • Run wp user create --prompt
  • Fill out the required (and optional fields)
  • See the missing user-name and user-email fields in the printed command

Let us know what environment you are running this on

OS:	Linux 6.6.0-1-MANJARO #1 SMP PREEMPT_DYNAMIC Mon Oct 30 07:08:14 UTC 2023 x86_64
Shell:	
PHP binary:	/usr/bin/php
PHP version:	8.1.23
php.ini used:	/etc/php/8.1/cli/php.ini
MySQL binary:	/usr/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:	/var/www/html/wp-cli
WP-CLI vendor dir:	/var/www/html/wp-cli/vendor
WP_CLI phar path:	
WP-CLI packages dir:	
WP-CLI cache dir:	/home/bernhard/.wp-cli/cache
WP-CLI global config:	
WP-CLI project config:	/var/www/html/wp-cli.yml
WP-CLI version:	2.10.0-alpha

(Run inside ddev)

@swissspidy
Copy link
Member

Thanks for the report!

Looks like prompting is handled here: https://github.com/wp-cli/wp-cli/blob/5d5a44d50d4dbfc76f35b6f31381575b9f9c7d6f/php/WP_CLI/Dispatcher/Subcommand.php

So if someone wants to jump in to fix this, that's the repo to work on.

Given that it's a more generic logic there, this probably affects many commands.

@2ndkauboy
Copy link
Author

@swissspidy thanks! I was not able to find out where the prompt was handled. I'll take a look at this then.

@2ndkauboy
Copy link
Author

As I was searching in the wrong directory, this issue was already reported. It can be found here: wp-cli/wp-cli#5768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants