@@ -146,6 +146,7 @@ import {Wipoid} from './wipoid';
146
146
import { Xbox } from './xbox' ;
147
147
import { Zotac } from './zotac' ;
148
148
import { logger } from '../../logger' ;
149
+ import chalk from 'chalk' ;
149
150
150
151
export const storeList = new Map ( [
151
152
[ AComPC . name , AComPC ] ,
@@ -323,14 +324,6 @@ function filterBrandsSeriesModels() {
323
324
}
324
325
325
326
function printConfig ( ) {
326
- if ( config . store . stores . length > 0 ) {
327
- logger . info (
328
- `ℹ selected stores: ${ config . store . stores
329
- . map ( store => store . name )
330
- . join ( ', ' ) } `
331
- ) ;
332
- }
333
-
334
327
if ( config . store . showOnlyBrands . length > 0 ) {
335
328
logger . info ( `ℹ selected brands: ${ config . store . showOnlyBrands . join ( ', ' ) } ` ) ;
336
329
}
@@ -350,6 +343,38 @@ function printConfig() {
350
343
if ( config . store . showOnlySeries . length > 0 ) {
351
344
logger . info ( `ℹ selected series: ${ config . store . showOnlySeries . join ( ', ' ) } ` ) ;
352
345
}
346
+
347
+ if ( config . store . stores . length > 0 ) {
348
+ const stores = darkenEmptyStores ( ) ;
349
+ logger . info ( `ℹ selected stores: ${ stores . names . join ( ', ' ) } ` ) ;
350
+
351
+ if ( stores . anyExcluded ) {
352
+ logger . warn (
353
+ 'ℹ some of the selected stores (grayed out) dont have what you are looking for'
354
+ ) ;
355
+ }
356
+ }
357
+ }
358
+
359
+ function darkenEmptyStores ( ) : { names : string [ ] ; anyExcluded : boolean } {
360
+ let anyExcluded = false ;
361
+ const selectedStores = config . store . stores . map ( store => store . name ) ;
362
+
363
+ const names = selectedStores . map ( selected => {
364
+ const storeConfig = storeList . get ( selected ) ;
365
+ const hasAny =
366
+ storeConfig ?. links . some (
367
+ l =>
368
+ ( config . store . showOnlySeries ?. includes ( l . series ) ?? false ) ||
369
+ config . store . showOnlyBrands ?. includes ( l . brand ?? false ) ||
370
+ ( config . store . showOnlyModels ?. map ( m => m . name ) . includes ( l . model ) ??
371
+ false )
372
+ ) ?? false ;
373
+
374
+ anyExcluded = anyExcluded || ! hasAny ;
375
+ return hasAny ? selected : chalk . gray ( selected ) ;
376
+ } ) ;
377
+ return { names, anyExcluded} ;
353
378
}
354
379
355
380
function warnIfStoreDeprecated ( store : Store ) {
0 commit comments