diff --git a/flags/flags.ts b/flags/flags.ts index b7222ef0..0faf75f8 100644 --- a/flags/flags.ts +++ b/flags/flags.ts @@ -143,6 +143,7 @@ export function parseFlags = Record>( } /** Parse next argument for current option. */ + // deno-lint-ignore no-inner-declarations function parseNext(option: IFlagOptions, args: IFlagArgument[]): void { const arg: IFlagArgument = args[argIndex]; diff --git a/flags/validate-flags.ts b/flags/validate-flags.ts index de753be8..9e8ed2ea 100644 --- a/flags/validate-flags.ts +++ b/flags/validate-flags.ts @@ -76,7 +76,7 @@ export function validateFlags( } option.conflicts?.forEach((flag: string) => { - if (isset(flag)) { + if (isset(flag, values)) { throw new Error( `Option --${option.name} conflicts with option: --${flag}`, ); @@ -85,7 +85,7 @@ export function validateFlags( option.depends?.forEach((flag: string) => { // don't throw an error if the value is coming from the default option. - if (!isset(flag) && !defaultValues[option.name]) { + if (!isset(flag, values) && !defaultValues[option.name]) { throw new Error(`Option --${option.name} depends on option: --${flag}`); } }); @@ -104,12 +104,6 @@ export function validateFlags( throw new Error(`Missing value for option: --${option.name}`); } }); - - function isset(flag: string): boolean { - const name = paramCaseToCamelCase(flag); - // return typeof values[ name ] !== 'undefined' && values[ name ] !== false; - return typeof values[name] !== "undefined"; - } } for (const option of flags) { @@ -132,3 +126,9 @@ export function validateFlags( throw new Error("No arguments."); } } + +function isset(flag: string, values: Record): boolean { + const name = paramCaseToCamelCase(flag); + // return typeof values[ name ] !== 'undefined' && values[ name ] !== false; + return typeof values[name] !== "undefined"; +} diff --git a/prompt/toggle.ts b/prompt/toggle.ts index 80d4c674..d42e827b 100644 --- a/prompt/toggle.ts +++ b/prompt/toggle.ts @@ -122,7 +122,6 @@ export class Toggle extends GenericPrompt { case this.settings.inactive: return false; } - return; } protected format(value: boolean): string {