-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked
run
Command Parsing (#50559)
Removes the manual command parsing in favor of letting Docker handle it the way that it normally would. It adds double dash support to pass options to the container and removes the second shell that was further handling any quotes and shell tokens.
- Loading branch information
1 parent
447126e
commit 9c9fe12
Showing
7 changed files
with
121 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
/** | ||
* A list of the containers that we can use `run` on. | ||
*/ | ||
const RUN_CONTAINERS = [ | ||
'mysql', | ||
'tests-mysql', | ||
'wordpress', | ||
'tests-wordpress', | ||
'cli', | ||
'tests-cli', | ||
]; | ||
|
||
/** | ||
* Custom parsing and validation for the "run" command's container argument. | ||
* | ||
* @param {string} value The user-set container. | ||
* | ||
* @return {string} The container name to use. | ||
*/ | ||
function validateRunContainer( value ) { | ||
// Give special errors for deprecated containers. | ||
if ( value === 'phpunit' ) { | ||
throw new Error( | ||
"The 'phpunit' container has been removed. Please use 'wp-env run tests-cli --env-cwd=wp-content/path/to/plugin phpunit' instead." | ||
); | ||
} | ||
if ( value === 'composer' ) { | ||
throw new Error( | ||
"The 'composer' container has been removed. Please use 'wp-env run cli --env-cwd=wp-content/path/to/plugin composer' instead." | ||
); | ||
} | ||
|
||
return value; | ||
} | ||
|
||
module.exports = { | ||
RUN_CONTAINERS, | ||
validateRunContainer, | ||
}; |