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

Allow theme slug renaming

Open ailaG opened this issue 7 years ago • 6 comments

Please allow theme slug renaming. For example: wp install theme .zip --slug=foo

I just encountered that need when I used URLs from GitLab. I installed a parent theme, and it was given a weird name that the host probably derives from its commit ID. Then I tried to install its child theme, and got an error, because it couldn't find its parent theme. If I could install the parent theme and set its slug, that wouldn't have happened.

ailaG avatar Jan 07 '18 03:01 ailaG

Please allow theme slug renaming. For example: wp install theme .zip --slug=foo

How is this different than using unzip?

danielbachhuber avatar Jan 10 '18 15:01 danielbachhuber

WP-CLI already supports an action that is similar to unzip, namely installing a plugin/theme from a ZIP file, instead of from the plugin repository.

As we already have that functionality, we should make sure that it is useful in all of the common scenarios, ZIP files having the wrong slug is a very common scenario, so I think we should add support for that.

schlessera avatar Jan 12 '18 09:01 schlessera

Couple other pieces of relevant information:

  • WP-CLI already has magical renaming behavior for GitHub URLs: https://github.com/wp-cli/wp-cli/issues/2994
  • wp theme install <theme|zip|url>... supports multiple sources. A --slug=<slug> argument could only work with one theme specified because multiple themes can't be installed to the same directory.

danielbachhuber avatar Jan 16 '18 00:01 danielbachhuber

Yes, when I looked through the code and saw the renaming for the Github URLs, I thought we could build the slug parameter so that:

  • --adapt-slug=<name> will put the theme into a folder <name>
  • --adapt-slug will extract the ZIP, check the plugin/theme header for the name and use that as slug.

The second variation (without argument) could also be used for multiple archives.

schlessera avatar Jan 16 '18 07:01 schlessera

Yes, when I looked through the code and saw the renaming for the Github URLs, I thought we could build the slug parameter so that:

  • --adapt-slug=<name> will put the theme into a folder <name>
  • --adapt-slug will extract the ZIP, check the plugin/theme header for the name and use that as slug.

The second variation (without argument) could also be used for multiple archives.

Hi, any updates on this? Running into same issue when installing plugins from github in CI/CD as zips (have an action which builds the whole plugin and attaches is as release.zip for each release). They get extracted as release-55y616 folder (even tho the folder name inside the release.zip is just release.

That means that on each wp plugin update https://github.com/org-name/projectname/releases/download/1.2.3/release.zip it will download it into a different folder.

Having either of the two proposed options above would help solve this.

MetarDev avatar Jul 29 '21 13:07 MetarDev