midi: valid syntax check
This commit is contained in:
parent
872a125201
commit
53a76e7933
3 changed files with 13 additions and 4 deletions
|
|
@ -182,12 +182,15 @@ class Settings {
|
|||
}
|
||||
|
||||
if (fail || v !== '' && data.check && data.check(v, this.options) !== true) {
|
||||
if (!field.classList.contains('error')) {
|
||||
field.classList.add('error')
|
||||
terminal.log(`(ERROR) --${name}: ${fail || data.check(v, this.options)}`, 'error')
|
||||
let error = `(ERROR) --${name}: ${fail || data.check(v, this.options)}`
|
||||
field.classList.add('error')
|
||||
if (field.getAttribute('data-error') !== error) {
|
||||
terminal.log(error, 'error')
|
||||
field.setAttribute('data-error', error)
|
||||
}
|
||||
} else {
|
||||
field.classList.remove('error')
|
||||
field.removeAttribute('data-error')
|
||||
this.options[name] = v
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,12 @@ module.exports = {
|
|||
'Targets must be ip: port pairs & port must be >= 1024' : true
|
||||
}
|
||||
},
|
||||
'm': {alias: 'midi', type: 'array', describe: 'midi router settings'},
|
||||
'm': {alias: 'midi', type: 'array', describe: 'midi router settings',
|
||||
check: (o)=>{
|
||||
var err = o.filter(item=>!item.match(/^(list|jack|sysex|pc_offset|path=(.*)|[^:]+:(virtual|(-1|[0-9]+),(-1|[0-9]+)))$/))
|
||||
return err.length ? `Invalid option${err.length > 1 ? 's' : ''}: ${err.join(', ')}` : true
|
||||
}
|
||||
},
|
||||
'd': {alias: 'debug', type: 'boolean', describe: 'log received osc messages in the console'},
|
||||
'n': {alias: 'no-gui', type: 'boolean', describe: 'disable default gui'},
|
||||
't': {alias: 'theme', type: 'array', describe: 'theme name or path (mutliple values allowed)'},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue