fixes
This commit is contained in:
@ -11,12 +11,22 @@ interface Option {
|
||||
type: OptionType;
|
||||
required?: boolean;
|
||||
default: unknown;
|
||||
alias: string;
|
||||
env: string;
|
||||
}
|
||||
|
||||
interface OptionProcess extends Option {
|
||||
filled: boolean;
|
||||
}
|
||||
|
||||
export class InteractiveOptions extends Persistent {
|
||||
protected options: Array<OptionProcess>;
|
||||
|
||||
public constructor (options: Array<Option>) {
|
||||
super ();
|
||||
for (const option of options) {
|
||||
this.options = options
|
||||
.map ((v) => ({ filled: false, ...v } as OptionProcess));
|
||||
for (const option of this.options) {
|
||||
if (typeof option.default !== option.type) {
|
||||
throw new Error (
|
||||
`default does not match option type on ${option.name}`
|
||||
@ -25,4 +35,22 @@ export class InteractiveOptions extends Persistent {
|
||||
this.properties[option.name] = option.type;
|
||||
}
|
||||
}
|
||||
|
||||
public async parse (): Promise<void> {
|
||||
this.get_env_options ();
|
||||
this.get_args_options ();
|
||||
await this.get_interactive_options ();
|
||||
}
|
||||
|
||||
private get_env_options (): void {
|
||||
|
||||
}
|
||||
|
||||
private get_args_options (): void {
|
||||
|
||||
}
|
||||
|
||||
private async get_interactive_options (): Promise<void> {
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user