mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-03 19:32:42 +02:00
update configuration docs.
This commit is contained in:
parent
76066aeae7
commit
856b0ec15a
6 changed files with 100 additions and 19 deletions
|
@ -5,9 +5,17 @@ const path = require('path');
|
|||
const parseConfigOptions = (text) => {
|
||||
const lines = text.split('\n');
|
||||
return lines.map(line => {
|
||||
const match = line.match(/--([\w.]+)(?:\s(\w+))?\s+(.*?)(?:\s+\(default\s+"?([\w\/.@]+)"?\))?$/);
|
||||
const match = line.match(/--([\w.]+)(?:\s(\w+))?\s+(.*?)(?:\s+\(default\s+"?([^"]+)"?\))?$/);
|
||||
if (match) {
|
||||
const [, key, type, description, defaultValue] = match;
|
||||
let [, key, type, description, defaultValue] = match;
|
||||
// if the type is not specified, it is a boolean
|
||||
if (!type) {
|
||||
type = 'boolean';
|
||||
// if the default value is not specified, it is false
|
||||
if (defaultValue !== 'false') {
|
||||
defaultValue = 'true';
|
||||
}
|
||||
}
|
||||
return { key: key.split('.'), type, defaultValue: defaultValue || undefined, description };
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue