/* eslint-disable no-process-exit */ /* eslint-disable no-console */ /* * Copyright (C) Sapphirecode - All Rights Reserved * This file is part of console-app which is released under MIT. * See file 'LICENSE' for full license details. * Created by Timo Hocker , May 2020 */ /* eslint-disable max-lines-per-function */ /* eslint-disable complexity */ /* eslint-disable max-statements */ /* eslint-disable no-process-env */ import { Persistent } from '@sapphirecode/modelling'; import { TypeValidation } from './Types/TypeValidation'; import { PathType } from './Types/PathType'; import { Option, OptionProcess, OptionType } from './Types'; import { OptionSource } from './Sources/OptionSource'; import { EnvSource } from './Sources/EnvSource'; import { ArgSource } from './Sources/ArgSource'; import { InteractiveSource } from './Sources/InteractiveSource'; const types: Record = { string: new TypeValidation ('string'), number: new TypeValidation ('number'), boolean: new TypeValidation ('boolean'), file: new PathType ('file'), folder: new PathType ('folder'), path: new PathType ('path') }; interface SourceConfig { env: boolean; args: boolean; interactive: boolean; } export class InteractiveOptions extends Persistent { protected options: Array; protected quiet = false; protected sources: OptionSource[] = []; public constructor ( options: Array