Improve examples and logging, and fix PCOV setup on linux

This commit is contained in:
Shivam Mathur
2019-10-04 19:34:05 +05:30
parent ba5306eea9
commit 17d90ace86
10 changed files with 289 additions and 103 deletions

View File

@ -157,13 +157,22 @@ export async function INIArray(ini_values_csv: string): Promise<Array<string>> {
export async function log(
message: string,
os_version: string,
log_type: string
log_type: string,
prefix = ''
): Promise<string> {
const unix_color: any = {
error: '31',
success: '32',
warning: '33'
};
switch (prefix) {
case '':
prefix = prefix;
break;
default:
prefix = prefix + ': ';
break;
}
switch (os_version) {
case 'win32':
const color: any = {
@ -171,13 +180,24 @@ export async function log(
success: 'green',
warning: 'yellow'
};
return "Write-Host '" + message + "' -ForegroundColor " + color[log_type];
return (
"Write-Host '" +
prefix +
message +
"' -ForegroundColor " +
color[log_type]
);
case 'linux':
case 'darwin':
default:
return (
'echo "\\033[' + unix_color[log_type] + ';1m' + message + '\\033[0m"'
'echo "\\033[' +
unix_color[log_type] +
';1m' +
prefix +
message +
'\\033[0m"'
);
}
}