introduced 'autoFixConsistencyIssues' option to control whether consistency issues should be auto fixed or note

This commit is contained in:
zadam
2019-11-10 11:25:41 +01:00
parent 8f2d2b189c
commit 466a4802b6
3 changed files with 36 additions and 12 deletions

View File

@@ -10,6 +10,9 @@ async function getOption(name) {
return option.value;
}
/**
* @return {Promise<number>}
*/
async function getOptionInt(name) {
const val = await getOption(name);
@@ -22,6 +25,19 @@ async function getOptionInt(name) {
return intVal;
}
/**
* @return {Promise<boolean>}
*/
async function getOptionBool(name) {
const val = await getOption(name);
if (!['true', 'false'].includes(val)) {
throw new Error(`Could not parse "${val}" into boolean for option "${name}"`);
}
return val === 'true';
}
async function setOption(name, value) {
const option = await require('./repository').getOption(name);
@@ -64,6 +80,7 @@ async function getOptionsMap(allowedOptions) {
module.exports = {
getOption,
getOptionInt,
getOptionBool,
setOption,
createOption,
getOptions,