console-app/lib/Option.ts

39 lines
848 B
TypeScript
Raw Normal View History

2020-05-15 16:53:45 +02:00
/*
* 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 <timo@scode.ovh>, May 2020
*/
2020-06-09 13:58:29 +02:00
import { TypeValidation } from './TypeValidation/TypeValidation';
2020-06-09 13:13:27 +02:00
interface SourceConfig {
console?: boolean,
configs?: string[],
env?: boolean,
interactive?: boolean,
}
2020-05-09 19:51:43 +02:00
interface Option {
name: string;
required?: boolean;
default?: unknown;
2020-06-09 13:13:27 +02:00
sources?: SourceConfig;
2020-06-09 13:58:29 +02:00
alias?: string;
env?: string;
message?: string;
error?: string;
2020-05-09 19:51:43 +02:00
}
2020-06-09 13:58:29 +02:00
class OptionValue {
public filled = false;
public value?: unknown;
public readonly type_validation: TypeValidation;
public constructor (type_validation: TypeValidation) {
this.type_validation = type_validation;
}
2020-05-09 19:51:43 +02:00
}
2020-06-09 13:13:27 +02:00
export { Option, OptionValue };