scaffold-command icon indicating copy to clipboard operation
scaffold-command copied to clipboard

--activate fails after running second time if theme_slug and theme_name are different.

Open NielsdeBlaauw opened this issue 2 years ago • 0 comments

Bug Report

Describe the current, buggy behavior Run the following commands in order:

$ vendor/bin/wp scaffold child-theme first_run --parent_theme=twentytwenty --theme_name="first_run_name" --activate --path=../../
Success: Created '/srv/www/wordpress-one/public_html/wp-cli-dev/scaffold-command/../../wp-content/themes/first_run'.
Success: Switched to 'first_run_name' theme.
$ rm -rf ../../wp-content/themes/first_run/
$ wp theme activate twentytwenty
$ vendor/bin/wp scaffold child-theme first_run --parent_theme=twentytwenty --theme_name="first_run_name" --activate --path=../../
Success: Created '/srv/www/wordpress-one/public_html/wp-cli-dev/scaffold-command/../../wp-content/themes/first_run'.
Error: The theme directory "first_run" does not exist.

During the second run the command incorrectly looks for first_run instead of first_run_name to switch to.

Describe what you would expect as the correct outcome

I would expect the server to switch to the correct theme.

Let us know what environment you are running this on

$ vendor/bin/wp cli info
OS:	Linux 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64
Shell:	/bin/bash
PHP binary:	/usr/bin/php
PHP version:	7.4.29
php.ini used:	/etc/php/7.4/cli/php.ini
MySQL binary:	/usr/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.5.16-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SQL modes:	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:	/srv/www/wordpress-one/public_html/wp-cli-dev/wp-cli
WP-CLI vendor dir:	/srv/www/wordpress-one/public_html/wp-cli-dev/wp-cli/vendor
WP_CLI phar path:	
WP-CLI packages dir:	/home/vagrant/.wp-cli/packages/
WP-CLI global config:	
WP-CLI project config:	/srv/www/wordpress-one/public_html/wp-cli-dev/scaffold-command/wp-cli.yml
WP-CLI version:	2.7.0-alpha

Provide a possible solution

Provide additional context/Screenshots Is partially related to #251 as @michaelandre0 already spotted this and I ran into the same situation fixing the path issue.

NielsdeBlaauw avatar Jun 02 '22 11:06 NielsdeBlaauw