WP-CLI tool support added

This commit is contained in:
Geoff Taylor
2020-02-21 23:36:14 -05:00
committed by Shivam Mathur
parent 03fd0b8719
commit d95ca49e8d
5 changed files with 73 additions and 3 deletions

View File

@ -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',