fixes
This commit is contained in:
parent
80d0dc4a48
commit
0e12cd0fb5
@ -11,12 +11,22 @@ interface Option {
|
|||||||
type: OptionType;
|
type: OptionType;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
default: unknown;
|
default: unknown;
|
||||||
|
alias: string;
|
||||||
|
env: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OptionProcess extends Option {
|
||||||
|
filled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InteractiveOptions extends Persistent {
|
export class InteractiveOptions extends Persistent {
|
||||||
|
protected options: Array<OptionProcess>;
|
||||||
|
|
||||||
public constructor (options: Array<Option>) {
|
public constructor (options: Array<Option>) {
|
||||||
super ();
|
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) {
|
if (typeof option.default !== option.type) {
|
||||||
throw new Error (
|
throw new Error (
|
||||||
`default does not match option type on ${option.name}`
|
`default does not match option type on ${option.name}`
|
||||||
@ -25,4 +35,22 @@ export class InteractiveOptions extends Persistent {
|
|||||||
this.properties[option.name] = option.type;
|
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> {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,9 +254,9 @@
|
|||||||
eslint-plugin-sort-requires-by-path "^1.0.2"
|
eslint-plugin-sort-requires-by-path "^1.0.2"
|
||||||
|
|
||||||
"@scode/modelling@^1.0.24":
|
"@scode/modelling@^1.0.24":
|
||||||
version "1.0.25"
|
version "1.0.26"
|
||||||
resolved "https://npm.scode.ovh/@scode%2fmodelling/-/modelling-1.0.25.tgz#d9b7dd4c13bdaffab3594601aa09b14757461900"
|
resolved "https://npm.scode.ovh/@scode%2fmodelling/-/modelling-1.0.26.tgz#e976a98762cb3c1b66af7d65616a50022230e5b1"
|
||||||
integrity sha512-6Li0G8AhDHMk/eZgFsARPncpdczcr25KRY32nGllIxnfmeaBvnVfbKGJWGFi7+D7WvBJh1UHcb7tWeU+zEro+Q==
|
integrity sha512-Pk6NXQ7HurAlCaLChvX8ycgbWZG31I2UwnKEyevvxYPS6WvNqFpEhxve1sRas1caQrVq0b626nyVjChviPZT+Q==
|
||||||
|
|
||||||
"@sindresorhus/is@^0.14.0":
|
"@sindresorhus/is@^0.14.0":
|
||||||
version "0.14.0"
|
version "0.14.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user