console-app/lib/Sources/OptionSource.ts
2020-05-09 19:51:43 +02:00

19 lines
400 B
TypeScript

import { OptionProcess } from '../Types';
export abstract class OptionSource {
public abstract async parse(opt: OptionProcess[]): Promise<void>;
protected async assign_arg (
opt: OptionProcess,
value: unknown
): Promise<void> {
try {
opt.value = await opt.type_validation.to_type (value);
opt.filled = true;
}
catch (e) {
// could not assing
}
}
}