console-app/lib/Sources/OptionSource.ts
2020-05-09 21:30:37 +02:00

19 lines
401 B
TypeScript

import { OptionProcess } from '../Option';
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
}
}
}