readme file now shows the script's url matches
This commit is contained in:
@@ -26,13 +26,33 @@ function readmeDataErrorString(error) {
|
||||
.join('\n');
|
||||
return `\n\n${error}`;
|
||||
}
|
||||
function arrayify(val) {
|
||||
let newval = Array.isArray(val) ? val : [val];
|
||||
return newval.map(v => v.trim()).filter(v => v);
|
||||
}
|
||||
function readmeDataMatches(meta) {
|
||||
const matches = arrayify(meta.match).map(v => '`' + v + '`');
|
||||
const matchesStr = `
|
||||
- ${matches.join(',')}`;
|
||||
if (matches.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const excludes = arrayify(meta.excludematch).map(v => '`' + v + '`');
|
||||
const excludesStr = `
|
||||
- excluding: ${excludes.join(',')}`;
|
||||
if (excludes.length === 0) {
|
||||
return matchesStr;
|
||||
}
|
||||
return matchesStr + excludesStr;
|
||||
}
|
||||
function readmeDataToString(results) {
|
||||
let { meta, error } = results;
|
||||
let errStr = error !== null ? '~~' : '';
|
||||
let errMsg = readmeDataErrorString(error);
|
||||
const matchesStr = readmeDataMatches(meta);
|
||||
return `
|
||||
- ${errStr}[${meta.name}](${meta.downloadURL})${errStr}${errMsg}
|
||||
- ${meta.namespace} ${meta.version}
|
||||
- **${meta.namespace}** v${meta.version}${matchesStr}
|
||||
- ${meta.description}
|
||||
`.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user