41 lines
940 B
TypeScript
41 lines
940 B
TypeScript
/*
|
|
* 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
|
|
*/
|
|
|
|
import { TypeValidation } from './TypeValidation/TypeValidation';
|
|
import { ErrorCallback } from './ErrorCallback';
|
|
|
|
interface SourceConfig {
|
|
console?: boolean,
|
|
configs?: string[],
|
|
env?: boolean,
|
|
interactive?: boolean,
|
|
}
|
|
|
|
interface Option {
|
|
name: string;
|
|
default?: unknown;
|
|
sources?: SourceConfig;
|
|
alias?: string;
|
|
env?: string;
|
|
message?: string;
|
|
error?: string;
|
|
error_callback?: ErrorCallback;
|
|
exit_on_interrupt?: boolean;
|
|
}
|
|
|
|
class OptionValue {
|
|
public filled = false;
|
|
public value?: unknown;
|
|
public readonly type_validation: TypeValidation;
|
|
|
|
public constructor (type_validation: TypeValidation) {
|
|
this.type_validation = type_validation;
|
|
}
|
|
}
|
|
|
|
export { Option, OptionValue };
|