This commit is contained in:
Timo Hocker 2020-06-09 21:23:26 +02:00
parent 021f55833d
commit 7574c250af

View File

@ -7,23 +7,31 @@
// @ts-nocheck // @ts-nocheck
/* eslint-disable no-console */ /* eslint-disable no-console */
/* eslint-disable id-match */
'use strict'; 'use strict';
// eslint-disable-next-line node/no-missing-require, id-match const {
const { InteractiveOptions } = require ('./dist/lib/index.js'); StringOption,
BooleanOption,
NumberOption,
ArrayOption,
FolderOption
} = require ('./dist/lib/index.js');
(async () => { (async () => {
const reader = new InteractiveOptions ([ const str = await new StringOption ({ name: 'str' })
{ name: 'str', type: 'string', env: 'TEST_STR' }, .parse ();
{ name: 'bool', type: 'boolean', env: 'TEST_BOOL' }, const bool = await new BooleanOption ({ name: 'bool' })
{ name: 'num', type: 'number', env: 'TEST_NUM' }, .parse ();
{ name: 'arr', type: 'array', env: 'TEST_ARR' }, const num = await new NumberOption ({ name: 'num' })
{ name: 'fld', type: 'folder', env: 'TEST_FOLDER' } .parse ();
], { const arr = await new ArrayOption ({ name: 'arr' })
exit_on_interrupt: true, .parse ();
configs: [ 'test.json' ], const fld = await new FolderOption ({ name: 'fld' })
error_callback: console.log .parse ();
});
await reader.parse (); const data = { str, bool, num, arr, fld };
console.log (reader.serialize (true));
console.log (data);
}) (); }) ();