mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-08-19 12:04:43 +07:00
WP-CLI tool support added
This commit is contained in:

committed by
Shivam Mathur

parent
03fd0b8719
commit
d95ca49e8d
@ -109,6 +109,8 @@ add_tool() {
|
||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
||||
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
||||
sudo chmod a+x "$tool_path"
|
||||
elif [ "$tool" = "wp-cli" ]; then
|
||||
sudo cp "$tool_path" /usr/local/bin/wp
|
||||
fi
|
||||
add_log "$tick" "$tool" "Added"
|
||||
else
|
||||
|
@ -165,6 +165,8 @@ add_tool() {
|
||||
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
|
||||
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
|
||||
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
|
||||
elif [ "$tool" = "wp-cli" ]; then
|
||||
sudo cp "$tool_path" /usr/local/bin/wp
|
||||
fi
|
||||
add_log "$tick" "$tool" "Added"
|
||||
else
|
||||
|
24
src/tools.ts
24
src/tools.ts
@ -308,6 +308,26 @@ export async function getSymfonyUri(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the WP-CLI url
|
||||
*
|
||||
* @param version
|
||||
*/
|
||||
export async function getWpCliUrl(version: string): Promise<string> {
|
||||
switch (version) {
|
||||
case 'latest':
|
||||
return 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar';
|
||||
default:
|
||||
return (
|
||||
'https://github.com/wp-cli/wp-cli/releases/download/v' +
|
||||
version +
|
||||
'/wp-cli-' +
|
||||
version +
|
||||
'.phar'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add/move composer in the tools list
|
||||
*
|
||||
@ -523,6 +543,10 @@ export async function addTools(
|
||||
url = github + 'symfony/cli/' + uri;
|
||||
script += await addArchive('symfony', version, url, os_version);
|
||||
break;
|
||||
case 'wp-cli':
|
||||
url = await getWpCliUrl(version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
break;
|
||||
default:
|
||||
script += await utils.addLog(
|
||||
'$cross',
|
||||
|
Reference in New Issue
Block a user