Equalize theme folder naming conventions across Win/Mac/Linux#196
Merged
schlessera merged 10 commits intowp-cli:masterfrom Nov 8, 2019
beaucollins:fix-121
Merged
Equalize theme folder naming conventions across Win/Mac/Linux#196schlessera merged 10 commits intowp-cli:masterfrom beaucollins:fix-121
schlessera merged 10 commits intowp-cli:masterfrom
beaucollins:fix-121
Conversation
schlessera
requested changes
Sep 27, 2019
| * a case sensitive name. | ||
| * @return string|boolean Case sensitive name if match found, otherwise false. | ||
| */ | ||
| private function find_inexact_match( $name, $existing_themes ) { |
Member
There was a problem hiding this comment.
We can integrate the suggestion algorithm in here that also accounts for typos.
First we need to add an import at the top of the file:
use WP_CLI\Utils;Then we can use that to also recognise words that are "close enough":
private function find_inexact_match( $name, $existing_themes ) {
$suggestion = Utils\find_suggestion(
strtolower( $name ),
array_keys( array_map( 'strtolower', $existing_themes ) )
);
if ( '' !== $suggestion ) {
return $suggestion;
}
return false;
}Now, you'll also receive suggestions with typos like:
Error: The 'Twentyelven' theme could not be found. Did you mean 'twentyeleven'?
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
Member
|
Failed tests are unrelated, merging regardless. |
Member
|
Thanks for the PR, @achyuthajoy & @beaucollins ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modified Theme Fetcher to strict compare specified theme slug against existing ones as a Workaround to Operating System folder naming conventions.
This will equalize the non-lowercase slugs across all operating systems. If exact slug is not found, error is returned.
Fix to #121 - More info added to the bug report
-- @achyuthajoy