@@ -415,37 +415,50 @@ class CategoryFilter extends Filter {
415415
416416    static  filterSyntax  =  [ 
417417        new  FixedStringSyntax ( "category" ) , 
418-         new  FixedStringSyntax ( "=" ) ,  // Separate, so initial suggestions are names only 
418+         new  StringOptionsSyntax < EqualityOperation > ( [ 
419+             "=" , 
420+             "!=" 
421+         ] ) , 
419422        new  StringOptionsSyntax ( EventCategories ) 
420423    ]  as  const ; 
421424
422425    static  filterName  =  "category" ; 
423426
424427    static  filterDescription ( value : string )  { 
425-         const  [ ,  ,  category ]  =  tryParseFilter ( CategoryFilter ,  value ) ; 
428+         const  [ ,  op ,  category ]  =  tryParseFilter ( CategoryFilter ,  value ) ; 
426429
427-         if  ( ! category )  { 
430+         if  ( ! op )  { 
428431            return  "exchanges by their general category" ; 
432+         }  else  if  ( ! category )  { 
433+             return  `exchanges ${ op  ===  '='  ? 'in'  : 'not in' }   a given category` ; 
429434        }  else  { 
430-             return  `all ${ category }   exchanges` ; 
435+             return  op  ===  '=' 
436+                 ? `all ${ category }   exchanges` 
437+                 : `all except ${ category }   exchanges` ; 
431438        } 
432439    } 
433440
434441    private  expectedCategory : string ; 
442+     private  op : EqualityOperation ; 
443+     private  predicate : ( category : string ,  expectedCategory : string )  =>  boolean ; 
435444
436445    constructor ( filter : string )  { 
437446        super ( filter ) ; 
438-         const  [ , ,  categoryString ]  =  parseFilter ( CategoryFilter ,  filter ) ; 
447+         const  [ ,  op ,  categoryString ]  =  parseFilter ( CategoryFilter ,  filter ) ; 
448+         this . op  =  op ; 
449+         this . predicate  =  operations [ this . op ] ; 
439450        this . expectedCategory  =  categoryString ; 
440451    } 
441452
442453    matches ( event : ViewableEvent ) : boolean  { 
443454        return  event . isHttp ( )  && 
444-             event . category   ===   this . expectedCategory 
455+             this . predicate ( event . category ,   this . expectedCategory ) ; 
445456    } 
446457
447458    toString ( )  { 
448-         return  _ . startCase ( this . expectedCategory ) ; 
459+         return  this . op  ===  '=' 
460+             ? _ . startCase ( this . expectedCategory ) 
461+             : `Not ${ _ . startCase ( this . expectedCategory ) }  ` ; 
449462    } 
450463} 
451464
0 commit comments