diff --git a/src/cli/precache.ts b/src/cli/precache.ts index 7a44a2c6..87a6306b 100644 --- a/src/cli/precache.ts +++ b/src/cli/precache.ts @@ -31,7 +31,7 @@ ${formattedServices}` let servicesToPreCache try { - servicesToPreCache = validateServices(argv) + servicesToPreCache = validateServices(argv, true) } catch (e) { this.error(e.message) } diff --git a/src/utils.ts b/src/utils.ts index 87e470f3..d363af55 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -33,13 +33,18 @@ export function capitalizeFirstLetter (value: string): string { return value.charAt(0).toUpperCase() + value.slice(1) } -export function validateServices (args: string[]): SupportedServices[] { +export function validateServices (args: string[], onlyEnabledForAll = false): SupportedServices[] { if (args.length === 0) { throw new Error('You have to specify a service!') } if (args.length === 1 && args[0] === 'all') { + if (!onlyEnabledForAll) { + return Object.values(SupportedServices) + } + return Object.values(SupportedServices) + .filter(service => config.get(`${service}.enabled`)) } for (const service of args) {