From 7574c250af7e1bf7098d56ead36f1213d5a04c75 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Tue, 9 Jun 2020 21:23:26 +0200 Subject: [PATCH] test --- AppTest.js | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/AppTest.js b/AppTest.js index 1acf357..ae8507a 100644 --- a/AppTest.js +++ b/AppTest.js @@ -7,23 +7,31 @@ // @ts-nocheck /* eslint-disable no-console */ +/* eslint-disable id-match */ + 'use strict'; -// eslint-disable-next-line node/no-missing-require, id-match -const { InteractiveOptions } = require ('./dist/lib/index.js'); +const { + StringOption, + BooleanOption, + NumberOption, + ArrayOption, + FolderOption +} = require ('./dist/lib/index.js'); (async () => { - const reader = new InteractiveOptions ([ - { name: 'str', type: 'string', env: 'TEST_STR' }, - { name: 'bool', type: 'boolean', env: 'TEST_BOOL' }, - { name: 'num', type: 'number', env: 'TEST_NUM' }, - { name: 'arr', type: 'array', env: 'TEST_ARR' }, - { name: 'fld', type: 'folder', env: 'TEST_FOLDER' } - ], { - exit_on_interrupt: true, - configs: [ 'test.json' ], - error_callback: console.log - }); - await reader.parse (); - console.log (reader.serialize (true)); + const str = await new StringOption ({ name: 'str' }) + .parse (); + const bool = await new BooleanOption ({ name: 'bool' }) + .parse (); + const num = await new NumberOption ({ name: 'num' }) + .parse (); + const arr = await new ArrayOption ({ name: 'arr' }) + .parse (); + const fld = await new FolderOption ({ name: 'fld' }) + .parse (); + + const data = { str, bool, num, arr, fld }; + + console.log (data); }) ();